Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Intercept messages of any window running?

Status
Not open for further replies.

gorgor

Programmer
Aug 15, 2002
164
0
0
US
I want to be able to intercept and show messages for any window running in any process. I already know how to filter through all running processes and find mainwindow handles for that process and thread ID's and such. Now what I want to do is create some kind of hook to intercept messages for any window of my choice. For now, I just want to display the messages going to that window in a listbox or something, much like you see in Spy++. I've done a ton of reading on creating hooks in C# (which requires importing Win32 methods), subclassing in C# and overriding winproc, and deriving from NativeWindows in C#, but haven't successfully been able to intercept any windows messages other than my own. Any ideas?

Thanks in advance!
 
can you access your windows parent object? and then hook all messages for that object, which would include ALL windows?
 
That's a good idea. I'll look into that. How do I hook all messages? I've seen examples on how to hook the mouse movement and keyboard, but haven't yet found an example on how to hook ALL messages. Do you know of any examples out there?
 
If I remember correctly, if you hook certain messages, the parent object gets first crack at them. so essentially hooking the messages to ALL the child objects.

Though I believe the parent of a standard window is the desktop, and its considered dangerous to subclass the desktop, it will often cause windows to crash. Or at least thats the way it was when I did that sort of thing on Win98, its probably much more stable in XP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top