LONG SetClassLong(hWnd,nIndex,dwNewLong)
This function replaces the long value specified by the nIndex parameter in the WNDCLASS data 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: | |
Parameter | Type/Description |
Value | Meaning | ||
GCL_MENUNAME | Sets a new long pointer to the menu name. | ||
GCL_WNDPROC | Sets a new long pointer to the window function. | ||
dwNewLong | DWORD Specifies the replacement value. |
The return value specifies the previous value of the specified long integer.
If the SetClassLong function and GCL_WNDPROC index are used to set a window function, the given function must have the window-function form and be exported in the module-definition file. See the RegisterClass function earlier in this chapter for details.
Calling SetClassLong with the GCL_WNDPROC index creates a subclass of the window class that affects all windows subsequently created with the class. 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 two-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 two-byte value in the extra space, 2 for the next two-byte value and so on.