函数参考


_WinAPI_DefSubclassProc

Calls the next handler in a window's subclass chain.

#Include <WinAPIEx.au3>
_WinAPI_DefSubclassProc ( $hWnd, $iMsg, $wParam, $lParam )

参数

$hWnd Handle to the window being subclassed.
$iMsg The message to be sent.
$wParam The message-specific information.
$lParam The message-specific information.

返回值

Success The returned value is specific to the message sent.
失败: 返回 0 并设置 @error 标志为非 0 值.

注意/说明

The last handler in the subclass chain is the original window procedure for the specified window. You do not
need to call the default window procedurethis function calls it automatically.

相关

详情参考

在MSDN中搜索


示例/演示


#Include <WinAPIEx.au3>
#Include <Extras\WMDebug.au3>

Opt('MustDeclareVars', 1)

Global $hForm, $hDll, $pDll

OnAutoItExitRegister('OnAutoItExit')

; 创建 GUI
$hForm = GUICreate('MyGUI')

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

; Install window subclass callback
_WinAPI_SetWindowSubclass($hForm, $pDll, 1000, 0)

GUISetState()

Do
Until GUIGetMsg() = -3

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

Func OnAutoItExit()
    _WinAPI_RemoveWindowSubclass($hForm, $pDll, 1000)
    DllCallbackFree($hDll)
EndFunc   ;==>OnAutoItExit