Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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!

Posted

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.

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...