Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can i send a keystroke from a program to another?

Status
Not open for further replies.

neilceschi

Programmer
Nov 13, 2000
1
IT
I have a program that start with a window with a "start" button: I want to create a little program that "clic" (virtually) this start button or send a "enter" keystroke. Can anybody help me?
 

You could send application B a message from application A telling application B a keystroke was received in application A. You don't need to send the actual stroke but just a message.

Check out SetWindowsHookEX() in MSDN. The SetWindowsHookEx function installs an application-defined hook procedure into a hook chain. You would install a hook procedure to monitor the system for certain types of events. These events are associated either with a specific thread or with all threads in the system. Never used it but I've read about it. I think you'll want to set a WH_GETMESSAGE hook. It installs a hook procedure that monitors messages posted to a message queue. One app posts the message and the other read it.

Please let me know if you get this to work.

Hope this helps,

Brother C
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top