Click to See Complete Forum and Search --> : Loading ICM profiles


cristiX
February 12th, 2007, 02:42 AM
Hello all,

I tried to set a new .icm profile file for my monitor, but no chance, it didn't work. I used the following code:


DWORD pdwSize = MAX_PATH;
BOOL bResult = FALSE;
int ret = 0;
char szPath[MAX_PATH];
memset(szPath, 0, sizeof(szPath));

bResult = GetColorDirectory(NULL, szPath, &pdwSize);
HDC hDCDisplay = ::CreateDC("DISPLAY", NULL, NULL, NULL);

char szFile[] = "\\MyICMFile.icm";
if (bResult)
{
if (strcat(szPath, szFile) != NULL)
{
bResult = InstallColorProfile(NULL, szPath);
if (hDCDisplay != NULL)
{
ret = SetICMMode(hDCDisplay, ICM_ON);
}

if (ret)
{
bResult = SetICMProfile(hDCDisplay, szPath);
}
bResult = AssociateColorProfileWithDevice(NULL, szPath, "DISPLAY");
}
}

To create the DC I used also "\\\\.\\DISPLAY1" and "DISPLAY\0", but didn't work.

Thanks,
Cristian