Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Home » Tip Bank » C++
Language: C++
Expertise: Beginner
Dec 4, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Simulating Keystrokes

I am building an add-on application in Visual C++ 6.0. How can you send a key combination (such as Control+K) to another application to invoke a menu shortcut (for example, control+o for open in a file menu)? I can do this in VB using SendKeys, and I wondered how it can be done in VC++.

Under Win32, you can use the keybd_event API to send keystrokes to another application. This function is called by the keyboard driver's interrupt handler when a keystroke is detected so applications will not know the difference between a call to keybd_event and an actual key press.

If you are using NT 4 SP3 or later, you may want to use the newer SendInput function. Please refer to the API reference for additional details.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date