On Saturday 21 June 2008 09:43:26 am Alastair M. Robinson wrote:
> Hi :)
>
> Mitesh wrote:
> > For the latter I think the ICC profiles are kept insinde
> > WINDOWS/System32/../../ but for me the important thing is knowing the
> > name of the ICC profile to which my monitor is associated with.
>
> Here's what I do in PhotoPrint's Profile Manager on Win32. This doesn't
> handle multiple-monitors though - how that should be handled I don't know.
>
> char displayprofilename[MAX_PATH];
> HDC handle=GetDC(0); // Get the default screen handle
> DWORD dpsize=sizeof(displayprofilename)-1;
>
> if(GetICMProfile(handle,&dpsize,displayprofilename))
> {
> cerr << "Got profile: " << displayprofilename << ", " << dpsize << "
> bytes." << endl;
> }
> else
> cerr << "No profile associated with default display." << endl;
>
> Hope this helps,
> --
> Alastair M. Robinson
To get a device handle for a specific monitor on Windows in a multi monitor
setup you need to do something like this:
// Where left, right, top, bottom contain the global coordinates
// of the screen object we want to color manage.
// in my code these are set when I create the gamma
// table object for the device being calibrated. The
// initalization routine then calls getDisplay() to get
// the handle for the display device. It is assumed
// that top, bottom, left and right are all located in a
// single display. You can allso use the MonitorEnumProc()
// call back to get a list of devices along with the coordinates
// of each device.
int left, right, bottom, top;
static BOOL CALLBACK MonitorEnumProc(
HMONITOR hMonitor, // handle to display monitor
HDC hdcMonitor, // NULL, because EnumDisplayMonitors hdc is NULL
LPRECT displayCoordintes, // Virtual screen coordinates of this monitor
LPARAM name // Context data used to pass back display name in our case
)
{
MONITORINFOEX pmi;
if (displayCoordintes -> left <= clipRegion.left &&
displayCoordintes -> bottom >= clipRegion.top &&
displayCoordintes -> right >= clipRegion.left &&
displayCoordintes -> top <= clipRegion.top)
{
// display contains the widget
pmi.cbSize = sizeof(MONITORINFOEX);
if (GetMonitorInfo(hMonitor, (MONITORINFO *)&pmi) == 0)
{
printf("MonitorEnumProc - get_displays failed GetMonitorInfo\n");
return FALSE;
}
else // it worked we have the device we want
{
printf("Got a display name = ");
strcpy((char*) name, pmi.szDevice);
printf((char*)name);
printf("\n");
numMatchingDisplays++;
return TRUE;
}
}
else // this is OK as the device is not the one we want
{
printf("display found but clipping rectagle is wrong\n");
printf("display rect = %i %i %i %i\n", displayCoordintes ->
left,
displayCoordintes -> bottom,
displayCoordintes -> right,
displayCoordintes -> top);
printf("widget point = %i %i\n", clipRegion.left,
clipRegion.bottom);
return TRUE;
}
}
HDC getDisplay()
{
BOOL (WINAPI* pEnumDisplayDevices)(PVOID,DWORD,PVOID,DWORD);
char name[256];
HDC dispHand;
pEnumDisplayDevices = (BOOL (WINAPI*)(PVOID,DWORD,PVOID,DWORD))
GetProcAddress(LoadLibrary("USER32"), "EnumDisplayDevicesA");
numMatchingDisplays = 0;
if (EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&name) ==
0)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user