GetICMProfile

[This is preliminary documentation and subject to change.]

The GetICMProfile function retrieves the file name of the current output color profile for a specified device context.

BOOL WINAPI GetICMProfile(
  HDC hDC,
  LPDWORD lpcbName,
  LPTSTR lpszFilename
);
 

Parameters

hDC
Specifies a device context from which to retrieve the color profile.
lpcbName
Points to a DWORD that contains the size of the buffer pointed at by lpszFilename. On return this parameter contains the size of the buffer actually used if the function is successful. If the buffer is not large enough, this function will return value FALSE. The GetLastError() function will return ERROR_INSUFFICIENT_BUFFER. The DWORD pointed to by this parameter will contain the size needed for the lpscFilename buffer.
lpszFilename
Points to the buffer that receives the path name of the profile.

Return Values

If this function succeeds, the return value is TRUE. It also returns TRUE if the lpszFilename parameter is NULL and the size required for the buffer is copied into lpcbName.

If this function fails, the return value is FALSE.

Remarks

GetICMProfile obtains the file name of the current output profile regardless of whether or not color management is enabled for the device context.

Given a device context, GetICMProfile will output, through the parameter lpszFilename, the path name of the file containing the color profile currently being used by the device context. It will also output, through the parameter lpcbName, the length of the string containing the path name.

It is possible that the profile name returned by GetICMProfile will not be in the list of profiles returned by EnumICMProfiles. The EnumICMProfiles function returns all color space profiles that are associated with a device context (DC) whose settings match that of the DC. If the SetICMProfile function is used to set the current profile, a profile may be associated with the DC that does not match its settings. For instance, the SetICMProfile function can be used to associate the device-independent sRGB profile with a DC. This profile will be used as the current ICM profile for that DC, and calls to GetICMProfile will return its file name. However, the profile will not appear in the list of profiles that is returned from EnumICMProfiles.

If this function is called before any calls to the SetICMProfile function, it can be used to get the default profile for a device context.

QuickInfo

  Windows NT: Requires version 4.0 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in wingdi.h.
  Import Library: Use gdi32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Color Management Overview, ICM 2.0 Functions, EnumICMProfiles, SetICMProfile