EasyHook and sending keyboard input to hooked application

Aug 27, 2010 at 9:47 PM

I have successfully set up EasyHook to hook DrawText of a given program.  I am not an expert in remoting and am confused as to how to go about sending input to another program.  I pinvoked PostMessage to be able to send input directly to the hooked applicaton's keyboard queue.  This works perfectly as I require that input sent to the program from my code not steal focus or the cursor.  The problem arises when I want to send compound commands to the program like CTRL+C etc.  Single key and mouse clicks work just fine but as far as I can tell it is not possible to send compound clicks without stealing focus (so no SendKeys, keybrd_event etc etc since they all steal focus).  PostMessage with WM_COPY doesn't work for this application either.  I have tried Spy++ to see what messages are sent when a CTRL+C is executed in the hooked program, and I can't see any messages sent at all which makes me wonder if the CTRL+C is OS driven and independent of hooked application.

Given that EasyHook sets up an Interface between your code and memory space of the hooked program, shouldn't we be able to create a function that we can call from our code to send keyboard input as if it were coming straight from the hooked program?  I'm trying to wrap my head around what it would look like and am drawing a blank.


Thanks in advance