SetWindowWord

2.x

  WORD SetWindowWord(hwnd, nOffset, nVal)    
  HWND hwnd; /* handle of window, */  
  int nOffset; /* offset of value to set */
  WORD nVal; /* new value */

The SetWindowWord function places a word value at the specified offset into the extra window memory of the given window. Extra window memory is reserved by specifying a nonzero value in the cbWndExtra member of the WNDCLASS structure used with the RegisterClass function.

Parameters

hwnd

Identifies the window.

nOffset

Specifies the zero-based byte offset of the value to change. Valid values are in the range zero through the number of bytes of extra window memory, minus two (for example, if 10 or more bytes of extra memory were specified, a value of 8 would be an index to the fifth integer), or one of the following values:

Value Meaning

GWW_HINSTANCE Specifies the instance handle of the module that owns the window.
GWW_ID Specifies the identifier of the child window.

nVal

Specifies the word value to be placed in the window's reserved memory.

Return Value

The return value is the previous value of the specified word, if the function is successful. Otherwise, it is zero.

Comments

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

An application should call the SetParent function, not the SetWindowWord function, to change a value in the parent of a child window.

See Also

GetWindowWord, RegisterClass, SetParent, SetWindowLong