Sign in to follow this  
Followers 0
PhoenixXL

[HELP] Help is required SetWindowsHookEx

3 posts in this topic

#1 ·  Posted (edited)

Hello Everyone

I wanted to learn how to use the

_Winapi_SetWindowsHookEx with $WH_CALLWNDPROC

to monitor Messages

I tried it with notepad but it doesnt seem to work

CAUTION: The following script crashes the whole system

therefore 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)
endfunc

Thnx for your help and time :)

Edited 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.

Share this post


Link to post
Share on other sites



:guitar: 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

Share this post


Link to post
Share on other sites

I wanted to learn how to use the

I just wanted to know what is wrong in there

Thanks


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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0