When I use DllCallbackRegister zero is returned and @error is set to three. The helpfile doesn't explain the @error. Searching the forum reveals that no one else seems to have this same problem as far as I could see. Here is my code:
AutoIt
#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -w 7 -d #include <Misc.au3> _Singleton(@ScriptName) #include <WinAPI.au3> Global Const $hStub_MouseProc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr") Switch $hStub_MouseProc Case 0 ConsoleWrite("$hStub_MouseProc: " & $hStub_MouseProc & " @error: " & @error & @CRLF) Exit EndSwitch Global Const $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_MouseProc), _WinAPI_GetModuleHandle(0)) OnAutoItExitRegister("cleanup") Do Sleep(10) Until False Func _Mouse_Proc(Const $nCode, Const $wParam, Const $lParam) Switch $nCode >= 0 Case True ConsoleWrite("$nCode: " & $nCode & @CRLF) EndSwitch Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc Func cleanup() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_MouseProc) EndFunc
Windows 7 x64 -- AutoIt 3.3.9.5 & Stable