RemoveWindowSubclass function (commctrl.h)

Removes a subclass callback from a window.


BOOL RemoveWindowSubclass(
  [in] HWND         hWnd,
  [in] SUBCLASSPROC pfnSubclass,
  [in] UINT_PTR     uIdSubclass


[in] hWnd

Type: HWND

The handle of the window being subclassed.

[in] pfnSubclass


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

[in] uIdSubclass


The UINT_PTR subclass ID. This ID and the callback pointer uniquely identify this subclass callback. Note: On 64-bit versions of Windows this is a 64-bit value.

Return value

Type: BOOL

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


Subclass callbacks are identified by their combination of the callback address and the subclass ID defined by the calling process.

The SUBCLASS module defines helper functions that are used to subclass windows. The code maintains a single property on the subclassed window and dispatches various subclass callbacks to its clients as required. The client is provided reference data and a default processing API.

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.


Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header commctrl.h
Library Comctl32.lib
DLL Comctl32.dll (version 5.8 or later)
API set ext-ms-win-shell-comctl32-window-l1-1-0 (introduced in Windows 10, version 10.0.14393)

See also