Jump to content

Monitoring the notify messages of a control in another process?


FaridAgl
 Share

Recommended Posts

Well, the title almost says everything.

I have a target application that has a ListView on its GUI, I'm trying to hook the ListView's notify messages with my AutoIt script. The Notification that I want to hook is LVN_INSERTITEM, I'm want to get the text of every item that get added to the ListView.

If it was on my own GUI, it was kindly easy to achieve the goal with GUIRegisterMsg(), but I have no idea about hooking another process's notification from my AutoIt process.

Any help is greatly welcomed, some idea maybe.

Link to comment
Share on other sites

Hi,

It's a good question, try to hook the messages by setting your GUI as a child of your target wnd with the function _WinAPI_SetParent; then do as if the listview was on your GUI.

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Doesn't work.

Here is an example of how I tried to do this:

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $hParent = WinGetHandle('[Class:Notepad]')
If @error Then
MsgBox(16, '', 'Error 1')
Exit
EndIf

Global $hChild = GUICreate('Child Window', 450, 300)
GUICtrlCreateButton('', 10, 10, 100, 23)
GUISetState()

_WinAPI_SetParent($hChild, $hParent)
If @error Then
MsgBox(16, '', 'Error 2')
Exit
EndIf

If (GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY') == 0) Then
MsgBox(16, '', 'Error 3')
Exit
EndIf

While (True)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
ConsoleWrite('1')

Return $GUI_RUNDEFMSG
EndFunc
Edited by D4RKON3
Link to comment
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
 Share

  • Recently Browsing   0 members

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