SetWindowLong
SetWindowLong is a Windows API function used to set a value associated with a window, either in the window’s extra data or, commonly, its window procedure pointer. It is part of the family that includes GetWindowLong and their pointer-sized variants. In modern code, SetWindowLongPtr is preferred for proper 64-bit compatibility.
The API has two main forms. In 32-bit applications, the signature is LONG SetWindowLong(HWND hWnd, int nIndex,
The nIndex parameter selects what is being set. Common indices include GWLP_WNDPROC or GWL_WNDPROC to install
Return value: The function returns the previous value at the specified offset. If the function fails, the
Best practices: Use SetWindowLongPtr with GWLP_WNDPROC for subclassing, and prefer SetWindowLongPtr over SetWindowLong in modern, portable