Sign in to follow this  
Followers 0
ziggery

catch external WM_Messages

7 posts in this topic

hello everybody,

is it possible to catch WM_PAINT or WM_VSCROLL Message from 3rd Party apps like notepad.exe?

Im tryin to draw my own gui over some application.The drawing is fine,but i need to be notified when the user scrolls or resizes the window because the gui has to be moved and resized either.

I've tried the following:

global $hGUI = GUICreate("Test", 800, 600, -1, -1, BitOr($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_CLIPCHILDREN))
global $PID = Run("notepad.exe", "", @SW_HIDE)

Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

global $hMessageProc = DllCallbackRegister("CallWndProc", "long", "int;wparam;lparam")
global $hmod = _WinAPI_GetModuleHandle("notepad.exe")
ConsoleWrite($hMod) ;=0
global $hHook = _WinAPI_SetWindowsHookEx($WH_CALLWNDPROC, DllCallbackGetPtr($hMessageProc), $hmod)

and my hook:

func CallWndProc($nCode, $wParam, $lParam)

If $nCode < 0 Then
     Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
EndIf
if $nCode=0 Then ;HC_ACTION
;local $point=DllStructCreate($tagPOINT)
local $CWPSTRUCT=DllStructCreate("LPARAM lparam;WPARAM wparam;UINT msg;HWND hwnd",$lParam)
local $msgid=DllStructGetData($CWPSTRUCT,"msg")
;if DllStructGetData($CWPRETSTRUCT,"hwnd")=$hWnd Then
; ConsoleWrite("BA")
;endif
ConsoleWrite($msgID)

endif


Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
endfunc

doesnt work.The modulehandle always return 0 because its not mapped into my apps memory.

Any ideas?

Share this post


Link to post
Share on other sites



Here's another about the issue, which links to more threads.

Share this post


Link to post
Share on other sites

Here's another about the issue, which links to more threads.

Hi,

So why haven't you bumped the thread linked to know if the author has solved the problem?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

So why haven't you bumped the thread linked to know if the author has solved the problem?

Br, FireFox.

I referred to that thread because the links you pointed to in your last post in that thread appeared to be helpful and relevant to this issue and I wanted to make sure OP was aware of them.

Anyway, to the OP: If you've already seen those threads then my apologies. Good luck!

Share this post


Link to post
Share on other sites

I referred to that thread because the links you pointed to in your last post in that thread appeared to be helpful and relevant to this issue and I wanted to make sure OP was aware of them.

Anyway, to the OP: If you've already seen those threads then my apologies. Good luck!

So your problem is solved?

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

I've tried shellhooker but it doesnt monitor messages like WM_Paint or WM_VSCROLL. Im pretty sure to solve my problem i dont need to do this:

Inject a DLL into the target process, subclass the main window procedure so you can intercept the process's window messages, then set up some interprocess communication with your AutoIt script.

...since i just want to be notified when some window changes.there must be some easy way

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