Get Messages from another application

C

Capsule

Hi everyone!

I'm trying to get the windows messages sent to and from another
application.

I'm able to get the handle to this object, and I pass it into the
following function:

public class MyHookClass : NativeWindow {
public MyHookClass(IntPtr hWnd) {
// Assign the handle from the source window to this
class.
this.AssignHandle(hWnd);
}
protected override void WndProc(ref Message m) {
Console.WriteLine(m.ToString());
base.WndProc(ref m);
}
}

Problem is, nothing is ever shown.

My assumtion is that the object I'm trying to pull from is not a
NativeWindow, but when I look at it through Spy++, messages are
present.

I figure if Spy++ can do it, I should be able to also...

Any ideas?

I'm using .NET 2.0 and C#

thanks in advance
 
C

Capsule

Thanks for your time Ollie!

There is some good stuff in there, but it doesn't quite do what I'm
looking for. The control in question is on a third party application
and it wasn't written in .NET.

The application you sent above only deals with.NET assemblies...

After some more research, Seems like API calls is the way to do it.
PeekMessages might be the answer, but I still need to do further
research.

Any further insight would be greatly appreciated.

Again, thanks for your time
 
C

Capsule

I'm going to revive this thread... I have made progress with capturing
messages, and overriding the WndProc. I have even had success with
using the GWL_WNDPROC to redirect the WinProc output to my own
function.

However, it appears emulating the Spy++ is not possible using .NET when
it comes to third party software written in a platform other than .NET.


Has anyone had any success with something like this?

Any links or code samples would be appreciated.

Thanks,

Craig
 

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