Looking for Hooking

P

pigeonrandle

Hi,
Is it possible to hook another application's WM_MOVE messages using c#?
There seems to be some argument as to what messages you can hook and
whether you can listen in on other app's messages using .net.
I'm just looking for a straight answer really?

Thanks,
James Randle
 
T

Thomas T. Veldhouse

pigeonrandle said:
Hi,
Is it possible to hook another application's WM_MOVE messages using c#?
There seems to be some argument as to what messages you can hook and
whether you can listen in on other app's messages using .net.
I'm just looking for a straight answer really?

There is always unmanaged code that could be used ;-)
 
P

pigeonrandle

Thomas ,
I don't really mind how it's done as long as it works. I've never tried
hooking beofre and would like to 'get it right' 'the first time' if you
know what i mean?!

James.
 
P

pigeonrandle

Kevin,
Cheers for the reply dude. My browser is telling me i've already looked
at one of those (at which point i probably thought 'maybe theres an
easier way'!).

Thanks again,
James
 
T

Tom Spink

GhostInAK said:
Hello pigeonrandle,

Take a look at the NativeWindow class.

-Boo

Hi Boo,

Unfortunately, you cannot subclass a foreign process' window procedure.
 
P

pigeonrandle

Tom's right - i just tried it :(.

I dont suppose anyone has a specific example do they. I seem to have
about 4 projects on the go and am getting confused .-(

Cheers again,
James
 
G

GhostInAK

Hello Tom,

Ah.. then in that case one would need to use the Win32 SetWindowLong function.

-Boo
 
T

Tom Spink

GhostInAK said:
Hello Tom,

Ah.. then in that case one would need to use the Win32 SetWindowLong
function.

-Boo

Hi Ghost,

Unfortunately not. Processes do not have permissions to alter window
procedures in windows foreign to their process. It can't be done.

There are two options:

1) You can use DLL injection (totally OTT and not possible in C# for small
things) to inject your own code into the window procedure, and either
redirect the WndProc, or do something else.

2) You can use a global hook, if all you are interested in is the window
messages.
 

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

Similar Threads


Top