Returns the pointer to a callback function that can be passed to the Win32 API.
DllCallbackGetPtr ( handle )
Parameters
| handle | A DllCallback handle returned from DllCallbackRegister. |
Return Value
| Success: | The pointer to the callback function. |
| Failure: | 0. |
Remarks
Use DllCallbackGetPtr to pass the address of a callback function to the Win32 API when using DllCall.
Related
DllCall, DllCallBackRegister, DllCallbackFree
Example
; Create callback function
$handle = DLLCallbackRegister ("_EnumWindowsProc", "int", "hwnd;lparam")
; Call EnumWindows
DllCall("user32.dll", "int", "EnumWindows", "ptr", DllCallbackGetPtr($handle), "lparam", 10)
; Delete callback function
DllCallbackFree($handle)
; Callback Procedure
Func _EnumWindowsProc($hWnd, $lParam)
If WinGetTitle($hWnd) <> "" And BitAnd(WinGetState($hWnd), 2) Then
$res = MsgBox(1, WinGetTitle($hWnd), "$hWnd=" & $hWnd & @CRLF & "lParam=" & $lParam & @CRLF & "$hWnd(type)=" & VarGetType($hWnd))
If $res = 2 Then Return 0 ; Cancel clicked, return 0 to stop enumeration
EndIf
Return 1 ; Return 1 to continue enumeration
EndFunc