PhoenixXL Posted September 15, 2012 Share Posted September 15, 2012 (edited) Hello EveryoneI wanted to learn how to use the_Winapi_SetWindowsHookEx with $WH_CALLWNDPROCto monitor MessagesI tried it with notepad but it doesnt seem to workCAUTION: The following script crashes the whole systemtherefore please analyse it before executing.Script#include <WinAPI.au3> #include <WindowsConstants.au3> Global $hMessageProc = DllCallbackRegister("CallWndProc", "long", "int;wparam;lparam") Global $hmod = _WinAPI_LoadLibrary('notepad.exe') ;Maps notepad.exe module to the address space of the Calling thread Global $hHook = _WinAPI_SetWindowsHookEx($WH_CALLWNDPROC, DllCallbackGetPtr($hMessageProc), $hmod) ;This causes the Error ;The Following is never Executed the previous line crashes the SYSTEM. Global $PID = Run('notepad.exe', "", @SW_SHOW) func CallWndProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) local $CWPSTRUCT=DllStructCreate("LPARAM;WPARAM;UINT;HWND",$lParam) local $msgid=DllStructGetData($CWPSTRUCT,3) ConsoleWrite($msgID) Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) endfuncThnx for your help and time Edited September 16, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
stormbreaker Posted September 15, 2012 Share Posted September 15, 2012 Here is something to get ya started: http://www.codeproject.com/Articles/10037/How-to-change-the-MessageBox-window-Add-controls-a. The best way I have ever used to disturb someone (on their PC) ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
PhoenixXL Posted September 16, 2012 Author Share Posted September 16, 2012 I wanted to learn how to use theI just wanted to know what is wrong in thereThanks My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
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