#include <Windows.h> #include <Icm.h> #include <iostream> #include <string> #pragma comment(lib,"Mscms.lib") #define MAX_PATH 1024 BOOL flag = 0; int main() { WCHAR* szDisplayDeviceName = NULL; WCHAR szPath[MAX_PATH]; memset(szPath, 0, 1024); DISPLAY_DEVICE dd; dd.cb = sizeof(dd); if (flag = EnumDisplayDevices(L"\\\\.\\DISPLAY1", 0, &dd, EDD_GET_DEVICE_INTERFACE_NAME)) { if (flag = WcsGetDefaultColorProfile(WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER, dd.DeviceKey, CPT_ICC, CPST_PERCEPTUAL, 0, // dwProfileID -- doesn't seem to matter what value you use here MAX_PATH * sizeof(WCHAR), szPath)) { PROFILE profile; profile.cbDataSize = (DWORD)(wcslen(szPath) + 1) * sizeof(WCHAR); profile.dwType = PROFILE_FILENAME; profile.pProfileData = (PVOID)szPath; HPROFILE hProfile = OpenColorProfile(&profile, PROFILE_READ, FILE_SHARE_READ, OPEN_EXISTING); // now do something with the profile } } LPWSTR buffer; ENUMTYPEW pe = { 0 }; pe.dwSize = sizeof(pe); pe.dwVersion = ENUM_TYPE_VERSION; pe.dwFields = ET_DEVICENAME; pe.dwDeviceClass = CLASS_MONITOR; pe.pDeviceName = dd.DeviceKey; DWORD p = 0; DWORD size = 0; BOOL ret = EnumColorProfilesW(NULL, &pe, NULL, &size, &p); buffer = (LPWSTR)malloc(size); ret = EnumColorProfilesW(NULL, &pe, (BYTE*)buffer, &size, &p); LPWSTR temp = buffer; for (int i = 0; i < p; i++) { wprintf(L"%s\n", temp); printf("without null character: %zu\n", wcslen(temp)); temp += wcslen(temp) + 1; } flag = WcsSetDefaultColorProfile(WCS_PROFILE_MANAGEMENT_SCOPE_CURRENT_USER, dd.DeviceKey, CPT_ICC, CPST_PERCEPTUAL, 0, // dwProfileID -- doesn't seem to matter what value you use here buffer); free(buffer); return 1; }
这是列举出本机上的所有icm配置文件
原文链接: https://www.cnblogs.com/strive-sun/p/12565714.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍;
也有高质量的技术群,里面有嵌入式、搜广推等BAT大佬
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/404965
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!