# Function Reference

# _WinAPI_RemoveWindowSubclass

Removes a subclass callback from a window

#include <WinAPIShellEx.au3>
_WinAPI_RemoveWindowSubclass ( $hWnd, $pSubclassProc, $idSubClass )

## Parameters

$hWnd | Handle of the window being subclassed.
$pSubclassProc | A pointer to a window procedure. This pointer and the subclass ID uniquely identify this subclass callback. (See MSDN for more information)
$idSubClass | The subclass ID.

## Return Value

Success: | True.
Failure: | False.

## Related

_WinAPI_SetWindowSubclass, _WinAPI_DefSubclassProc

## See Also

Search RemoveWindowSubclass in MSDN Library.

## Example

    #include "Extras\WMDebug.au3"

    #include <GUIConstantsEx.au3>
    #include <WinAPIShellEx.au3>

    OnAutoItExitRegister('OnAutoItExit')

    ; Create GUI
    Global $g_hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'))

    ; Register DLL callback that will be used as window subclass procedure
    Global $g_hDll = DllCallbackRegister('_SubclassProc', 'lresult', 'hwnd;uint;wparam;lparam;uint_ptr;dword_ptr')
    Global $g_pDll = DllCallbackGetPtr($g_hDll)

    ; Install window subclass callback
    _WinAPI_SetWindowSubclass($g_hForm, $g_pDll, 1000, 0)

    GUISetState(@SW_SHOW)

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    Func _SubclassProc($hWnd, $iMsg, $wParam, $lParam, $iID, $pData)
        #forceref $iID, $pData
        ; Declared in WMDebug.au3
        _WM_Debug($hWnd, $iMsg, $wParam, $lParam)
        Return _WinAPI_DefSubclassProc($hWnd, $iMsg, $wParam, $lParam)
    EndFunc   ;==>_SubclassProc

    Func OnAutoItExit()
        _WinAPI_RemoveWindowSubclass($g_hForm, $g_pDll, 1000)
        DllCallbackFree($g_hDll)
    EndFunc   ;==>OnAutoItExit