SetColorProfileElement function (icm.h)

Sets the element data for a tagged profile element in an ICC color profile.


BOOL SetColorProfileElement(
  HPROFILE hProfile,
  TAGTYPE  tag,
  DWORD    dwOffset,
  PDWORD   pcbElement,
  PVOID    pElement



Specifies a handle to the ICC profile in question.


Identifies the tagged element.


Specifies the offset from the first byte of the tagged element data at which to start writing.


Pointer to a variable containing the number of bytes of data to write. On return, it contains the number of bytes actually written.


Pointer to a buffer containing the data to write to the tagged element in the color profile.

Return value

If this function succeeds, the return value is TRUE.

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


This function will fail if hProfile is not a valid ICC profile.

If the color profile is not opened for read/write permission, this function fails.

If dwOffset exceeds the size set for the specified tagged element, this function fails.

If dwOffset + *pcbSize is greater than the size of the specified element, this function only writes as many bytes as will fit within the current size of the element.

Any existing data in the specified portion of the tagged element is overwritten when this function succeeds.

This function does not support Windows Color System (WCS) profiles CAMP, DMP, and GMMP; because profile elements are implicitly associated with and hard coded to ICC tag types and there exist many robust XML parsing libraries.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header icm.h
Library Mscms.lib
DLL Mscms.dll

See also