4nt1h4cker Posted January 17, 2009 Posted January 17, 2009 I just tried to use SetWindowsHookEx in Autoit, first one good message i got i working so far. But i cant really handle the data. $vCallBack = DllCallbackRegister ( "_hook", "int", "int;wparam;lparam;"); ;~ ConsoleWrite ($vCallBack & @error) $threadid = DllCall("kernel32.dll", "dword", "GetCurrentThreadId") ;~ ConsoleWrite ( "thread id: "& $threadid[0] & @CRLF) $handle = DllCall ("user32.dll", "ptr", "SetWindowsHookEx", "int", 5, "ptr", DllCallbackGetPtr ($vCallBack), "int", 0, "dword", $threadid[0]) While 1 ;~ Sleep ( 1 ) WEnd func _hook ($nCode, $wParam, $lParam) ;~ ConsoleWrite ("here!") ;~ ConsoleWrite ($nCode & "|" & $wParam & "|" & $lParam & @CRLF ) if $nCode < 0 Then DllCall ( "user32.dll", "int", "CallNextHookEx", "ptr", $handle[0], "int", $nCode, "wparam", $wParam, "lparam", $lParam) Return EndIf if $nCode == 3 Then ConsoleWrite ( "Window created: " & WinGetTitle ( $wParam ) & @CRLF ) EndIf DllCall ( "user32.dll", "int", "CallNextHookEx", "ptr", $handle[0], "int", $nCode, "wparam", $wParam, "lparam", $lParam) EndFunc
monoceres Posted January 18, 2009 Posted January 18, 2009 SetWindowsHookEx is already implemented in the standard UDF library (_WinAPI_SetWindowHookEx()) with a working example. Play around with it Broken link? PM me and I'll send you the file!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now