Control Event Monitoring

J

jordan.yaker

I am in the process of creating a C# automation application that will
work off of notifications in other applications. I want to be able to
monitor the WM_NOTIFY event for various controls and then take the
corresponding actions (simple automation stuff).

I started out working on this by attempting to hook the parent of the
control that I am interested in. I created an unmanaged C DLL for
setting/clearing the hook, and for passing the messages to my managed
application via the PostMessage method. I am hooking with the
WH_CALLWNDPROC hook type and I just don't ever see the WM_NOTIFY
message. I was hoping that someone would be able to point me in the
right direction here. Anything from examples to tutorials would help.
 
N

not_a_commie

I am hooking with the
WH_CALLWNDPROC hook type and I just don't ever see the WM_NOTIFY
message. I was hoping that someone would be able to point me in the
right direction here. Anything from examples to tutorials would help.

I think that by default Forms in .NET ignore notify messages. Look up
the SetStyle function to see how to change that. (One of the enums for
that enables it, I believe.)

BTW, if the program you're monitoring is one that you have the source
code for, I'd strongly recommend sockets instead of Windows messages.
They're just much more portable.
 
W

Willy Denoyette [MVP]

I am in the process of creating a C# automation application that will
work off of notifications in other applications. I want to be able to
monitor the WM_NOTIFY event for various controls and then take the
corresponding actions (simple automation stuff).

I started out working on this by attempting to hook the parent of the
control that I am interested in. I created an unmanaged C DLL for
setting/clearing the hook, and for passing the messages to my managed
application via the PostMessage method. I am hooking with the
WH_CALLWNDPROC hook type and I just don't ever see the WM_NOTIFY
message. I was hoping that someone would be able to point me in the
right direction here. Anything from examples to tutorials would help.


Do you mean that you don't see any WM_NOTIFY message in the target (other) application? You
know that you won't get WM_NOTIFY messages from the target in your C# application, do you?.
Are you sure your hook proc is registered correctly, are you sure the DLL is injected in the
other process?
What message are you posting to the C# application and how do you get at the HWND of the
receiving window?

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top