sending command to another application

j00sh

Active member
Joined
Mar 29, 2007
Messages
35
Programming Experience
Beginner
not completely sure how to word this

I want to have my program running in the background. I want to have it so I can hit a hotkey, \, and everything I type after that until I hit enter will be sent to another program as a command. I don't want to lose focus of the current window, I want my program and the target program to remain in the background.

I just have no idea what to look for in the documentation to get started with this.
 
Anything that involves interaction with external applications almost always involves the use of the Windows API. In your case you're going to have to set global keyboard hook to capture the keyboard input, then use the SendMessage function to pass that input on to the other application. You're also likely to have to use the FindWindow and FindWindowEx functions to get the main window of the other application and the child control to send the input to.

Google for the API Viewer and the API Guide, which are tools you can install to help you work out which Windows API functions to use and also how to declare them in your own code. You will also want to use WinID to determine the class names of the external windows whose handles you want in order to send the keyboard input to the right place.

As for keyboard hooking, I've never done it myself so I can't talk details, but if you search MSDN and the Web for that term you should be able to find the information you need.

You should also note that this is a relatively advanced project, so if you don't have a fairly good grasp of the basics already you may find it quite difficult.
 
Back
Top