DllCallbackGetPtr
返回传递给 Win32 API 的回调函数指针.
DllCallbackGetPtr ( handle )
参数
返回值
备注
调用 DllCall() 时, 使用 DllCallbackGetPtr() 传递一个回调函数地址到 Win32 API.
相关
DllCall, DllCallbackFree, DllCallbackRegister
函数示例
#include <MsgBoxConstants.au3>
; Create callback function.
Local $hHandle = DllCallbackRegister("_EnumWindowsProc", "int", "hwnd;lparam")
; Call EnumWindows.
DllCall("user32.dll", "int", "EnumWindows", "ptr", DllCallbackGetPtr($hHandle), "lparam", 10)
; Delete callback function.
DllCallbackFree($hHandle)
; Callback Procedure
Func _EnumWindowsProc($hWnd, $lParam)
; If the Title is empty or if the window is not visible then continue enumeration.
If WinGetTitle($hWnd) = "" Or BitAND(WinGetState($hWnd), 2) = 0 Then Return 1
Local $iRes = MsgBox(BitOR($MB_SYSTEMMODAL, $MB_OKCANCEL), _
WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & _
"$lParam=" & $lParam & @CRLF & _
"$hWnd(type)=" & VarGetType($hWnd))
If $iRes <> $IDOK Then Return 0 ; Cancel/Close button clicked, return 0 to stop enumeration.
Return 1 ; Return 1 to continue enumeration.
EndFunc ;==>_EnumWindowsProc
----------------------------------------
|