LONG SetWindowLong(hWnd,nIndex,dwNewLong)
This function changes an attribute of the window specified by the hWnd parameter.
Parameter | Type/Description |
hWnd | HWND Identifies the window. | ||
nIndex | int Specifies the byte offset of the attribute to be changed. It may also be one of the following values: | ||
Value | Meaning | ||
GWL_EXSTYLE | Sets a new extended window style. | ||
GWL_STYLE | Sets a new window style. | ||
GWL_WNDPROC | Sets a new long pointer to the window procedure. | ||
dwNewLong | DWORD Specifies the replacement value. |
The return value specifies the previous value of the specified long integer.
If the SetWindowLong function and the GWL_WNDPROC index are used to set a new window function, that function must have the window-function form and be exported in the module-definition file of the application. For more information, see the RegisterClass function, earlier in this chapter.
Calling SetWindowLong with the GCL_WNDPROC index creates a subclass of the window class used to create the window. See Chapter 1, “Window Manager Interface Functions,” for more information on window subclassing. An application should not attempt to create a window subclass for standard Windows controls such as combo boxes and buttons.
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.