SetClassWord

Syntax

WORD SetClassWord(hWnd,nIndex,wNewWord)

This function replaces the word specified by the nIndex parameter in the WNDCLASS structure of the window specified by the hWnd parameter.

Parameter Type/Description  

hWnd HWND Identifies the window.  
nIndex int Specifies the byte offset of the word to be changed. It can also be one of the following values:  
  Value Meaning
  GCW_CBCLSEXTRA Sets two new bytes of additional window-class data.
  GCW_CBWNDEXTRA Sets two new bytes of additional window-class data.
  GCW_HBRBACKGROUND Sets a new handle to a background brush.
  GCW_HCURSOR Sets a new handle to a cursor.
  GCW_HICON Sets a new handle to an icon.
  GCW_STYLE Sets a new style bit for the window class.
wNewWord WORD Specifies the replacement value.  

Return Value

The return value specifies the previous value of the specified word.

Comments

The SetClassWord function should be used with care. For example, it is possible to change the background color for a class by using SetClassWord, but this change does not cause all windows belonging to the class to be repainted immediately.

To access any extra four-byte values allocated when the window-class structure was created, use a positive byte offset as the index specified by the nIndex parameter, starting at zero for the first four-byte value in the extra space, 4 for the next four-byte value and so on.