Hooking into another process?

  • Thread starter Thread starter Seth Gecko
  • Start date Start date
S

Seth Gecko

Hi

I want to make an application (in C#) that can catch text written to a
Richedit control in another application. Using Spy++ I can see that the
message I want to intercept is called EM_REPLACESEL. I have been googling
and I am pretty sure that the way forward is using SetWindowsHookEx, but the
hook I should use, I am not so sure about. WM_GETTEXT seems the only real
option. Another problem is that SetWindowsHookEx used from .Net will only
work on the same process, is this correct? Could I instead use a GetDlgItem,
but will this work on a window in another process?

As You properly can see, I am more than a little confused about the subject
atm. Could anyone please give me some directions (I have read the articles
from CuttingEdge, but it only seem to confirm that SetWindowsHookEx will
work within the same process)? Is there perhaps a free C dll which will
install a hook into the other process?

Thanks

Seth Gecko
 
The problem you will face is your code will be executing in the wrong
process space.

I suggest getting Advanced Windows Programming 5th edition (or later?) buy
richter, it has several chapters dedicated toprocess hooking, including
global hooks and a complete discussion of dll injection techniques.

You will need this knowledge.

- SEWilson
 
Back
Top