Grabbing handles on another process' forms


M

Mike Shafer

Hello! I was hoping to write a program that could monitor another
process' controls, but I know nothing about it. So this program would
spawn the monitored program, and it could grab a handle on all its
windows and components and actually read them (like read values in
TextBox's, for instance). I used winspy++ to see how it looks, but
the code for winspy++ is closed so I can't see how he did it. I would
like to do this in C# on the .NET framework. Does anyone know where I
could get started?

Thanks!
 
Ad

Advertisements

N

n!

the code for winspy++ is closed so I can't see how he did it. I would
like to do this in C# on the .NET framework. Does anyone know where I
could get started?

The functions required to perform this aren't available in the .NET
framework as standard AFAIK. You'll need to P/Invoke them. IIRC spy++ use
the Win32 API methods EnumWindows to retrieve the top level windows along
with EnumChildWindows. Finally installing a hook using the SetWindowsHookEx
method with the WH_CALLWNDPROC hook id and the window handle. Memories a bit
hazy, so it may not be entirely correct but should give you something to
look\think about.

n!
homepage: http://www.btinternet.com/~nfactorial/
blog: http://nfactorial.blogspot.com
 

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