Skip to content

Latest commit

 

History

History
107 lines (75 loc) · 3.78 KB

nf-commctrl-setwindowsubclass.md

File metadata and controls

107 lines (75 loc) · 3.78 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:commctrl.SetWindowSubclass
SetWindowSubclass function (commctrl.h)
Installs or updates a window subclass callback.
SetWindowSubclass
SetWindowSubclass function [Windows Shell]
commctrl/SetWindowSubclass
inet_SetWindowSubclass
shell.SetWindowSubclass
shell\SetWindowSubclass.htm
shell
0b11144d-eb4e-462c-96d3-38c4bac48f2a
12/05/2018
SetWindowSubclass, SetWindowSubclass function [Windows Shell], commctrl/SetWindowSubclass, inet_SetWindowSubclass, shell.SetWindowSubclass
commctrl.h
Windows
Windows XP [desktop apps only]
Windows Server 2003 [desktop apps only]
Comctl32.lib
Comctl32.dll (version 5.8 or later)
Windows
19H1
SetWindowSubclass
commctrl/SetWindowSubclass
c++
APIRef
kbSyntax
DllExport
Comctl32.dll
SetWindowSubclass
ext-ms-win-shell-comctl32-window-l1-1-0 (introduced in Windows 10, version 10.0.14393)

SetWindowSubclass function

-description

Installs or updates a window subclass callback.

-parameters

-param hWnd [in]

Type: HWND

The handle of the window being subclassed.

-param pfnSubclass [in]

Type: SUBCLASSPROC

A pointer to a window procedure. This pointer and the subclass ID uniquely identify this subclass callback. For the callback function prototype, see SUBCLASSPROC.

-param uIdSubclass [in]

Type: UINT_PTR

The subclass ID. This ID together with the subclass procedure uniquely identify a subclass. To remove a subclass, pass the subclass procedure and this value to the RemoveWindowSubclass function. This value is passed to the subclass procedure in the uIdSubclass parameter.

-param dwRefData [in]

Type: DWORD_PTR

DWORD_PTR to reference data. The meaning of this value is determined by the calling application. This value is passed to the subclass procedure in the dwRefData parameter. A different dwRefData is associated with each combination of window handle, subclass procedure and uIdSubclass.

-returns

Type: BOOL

TRUE if the subclass callback was successfully installed; otherwise, FALSE.

-remarks

Subclass callbacks are identified by the combination of the callback address and the caller-defined subclass ID. If the callback address and ID pair have not yet been installed, then this function installs the subclass. If the pair has already been installed, then this function just updates the reference data.

Each callback can store a single DWORD_PTR of reference data, which is passed to the callback function when it is called to filter messages. No reference counting is performed for the callback; it may repeatedly call SetWindowSubclass to alter the value of its reference data element.

Warning  You cannot use the subclassing helper functions to subclass a window across threads.
 

-see-also

DefSubclassProc

GetWindowSubclass

RemoveWindowSubclass