OpenColorProfile

[This is preliminary documentation and subject to change.]

The OpenColorProfile function creates a handle to a specified color profile. The handle can then be used in other profile management functions.

HPROFILE WINAPI OpenColorProfile(
  PPROFILE pProfile,
  DWORD dwDesiredAccess,
  DWORD dwShareMode,
  DWORD dwCreationMode
);
 

Parameters

pProfile
Pointer to a color profile structure specifying the profile.
dwDesiredAccess
Specifies how to access the given profile. This parameter must take one the following constant values:
Constant Meaning
PROFILE_READ Opens the profile for read access.
PROFILE_READWRITE Opens the profile for both read and write access.

dwShareMode
Specifies how the profile should be shared, if the profile is contained in a file. A value of zero prevents the profile from being shared at all. The parameter can contain one or both of the following constants (combined by addition or logical OR):
Constant Meaning
FILE_SHARE_READ Other open operations can be performed on the profile for read access.
FILE_SHARE_WRITE Other open operations can be performed on the profile for write access.

dwCreationMode
Specifies which actions to take on the profile while opening it, if it is contained in a file. This parameter must take one of the following constant values:
Constant Meaning
CREATE_NEW Creates a new profile. Fails if the profile already exists.
CREATE_ALWAYS Creates a new profile. Overwrites the profile if it exists.
OPEN_EXISTING Opens the profile. Fails if it does not exist
OPEN_ALWAYS Opens the profile if it exists. If it does not exist, creates the profile.
TRUNCATE_EXISTING Opens the profile, and truncates it to zero bytes. Fails if the profile doesn't exist.

Return Values

If this function succeeds, the return value is the handle of the color profile that is opened.

If this function fails, the return value is NULL. For extended error information, call GetLastError.

Remarks

If the profile data is not specified using a file name, dwShareMode and dwCreationMode are ignored.

Use the CloseColorProfile function to close an object handle returned by OpenColorProfile.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in icm.h.
  Import Library: Use mscms.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Color Management Overview, ICM 2.0 Functions, CloseColorProfile, PROFILE