GetWindowLongPtrA function (winuser.h)
Retrieves information about the specified window. The function also retrieves the value at a specified offset into the extra window memory.
LONG_PTR GetWindowLongPtrA( [in] HWND hWnd, [in] int nIndex );
A handle to the window and, indirectly, the class to which the window belongs.
The zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of a LONG_PTR. To retrieve any other value, specify one of the following values.
||Retrieves the extended window styles.|
||Retrieves a handle to the application instance.|
||Retrieves a handle to the parent window, if there is one.|
||Retrieves the identifier of the window.|
||Retrieves the window styles.|
||Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.|
||Retrieves the pointer to the window procedure, or a handle representing the pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.|
The following values are also available when the hWnd parameter identifies a dialog box.
||Retrieves the pointer to the dialog box procedure, or a handle representing the pointer to the dialog box procedure. You must use the CallWindowProc function to call the dialog box procedure.|
||Retrieves the return value of a message processed in the dialog box procedure.|
||Retrieves extra information private to the application, such as handles or pointers.|
If the function succeeds, the return value is the requested value.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
If SetWindowLong or SetWindowLongPtr has not been called previously, GetWindowLongPtr returns zero for values in the extra window or class memory.
Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the WNDCLASSEX structure used with the RegisterClassEx function.
The winuser.h header defines GetWindowLongPtr as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|API set||ext-ms-win-ntuser-windowclass-l1-1-0 (introduced in Windows 8)|