The role of additional data:
When registering a window, setting the size of these two data can provide the window class and the window to store their own data space.
1. Window class additional data
int Cbclsextra//window class additional data buff size
(1) Usage:
A. Application buffer
The Window object. Cbclsextra = 200; Multiples of 4 are generally assigned
B. Writing data
DWORD Setclasslong (
HWND hwnd; Window handle
int nIndex; BYTE index number (from which byte to save)
LONG Dwnewlong; The data deposited
);
C. Reading data
DWORD Getclasslong (
HWND hwnd; Window handle
int nIndex; BYTE index number (from which byte to begin reading)
)///return value gets the read data
2. Window Append Data buffer
int Cbwndextra//window additional data buff size
(1) Usage:
A. Application buffer
The Window object. Cbwndextra = 200; It's usually a multiple of 4.
A. Writing data
LONG SetWindowLong (
HWND hwnd; Window handle
int nIndex; BYTE index number (from which byte to save)
LONG Dwnewlong; Data being written
);
C. Reading data
LONG GetWindowLong (
HWND hwnd; Window handle
int nIndex; BYTE index number (from which byte to begin reading)
);//The return value is the read data
3. Differences
Window class Append Data buffer: is a buffer that is shared by all windows that are created based on the window class.
Window Append Data buffer: Is the window's own private buffer, even if it is based on the same window class created by the window, do not share with each other.
5. Additional data for window classes and windows