Link to home
Start Free TrialLog in
Avatar of hackman_3vilGuy
hackman_3vilGuy

asked on

C# SendKeys to Foreground App

Hi,
I'm creating a program in C# that will run in the background on my pc. The program is a custom server and I will send a message to it remotely telling it to fake press a certain key. I have already made all of the code to receive the messages remotely and am just stuck where I actually have the key to send. I tried using SendKeys but this only seems to work for the active window whereas I want to be able to send keys remotely to the foreground app whatever it is or even to no window - just as if the key had been pressed on the keyboard.
Any ideas?
Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

Check out this thread on a microsoft forum.

It will give you clues on getting the window handle, etc and then sending the msg (sendkeys) to it.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=923086&SiteID=1
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hackman_3vilGuy
hackman_3vilGuy

ASKER

I'm using SendInput API