You are here:

C++/Key presses

Advertisement


Question
Hi, I'm a really new programmer and I want to know, how do I make C++ automatically press a key down for me when I run a program?  I'm wanting to make a shift-key auto-presser for me and my friends.

Answer
Hello,

I sincerely, have not tried this before but a little research brought up this article : http://msdn.microsoft.com/en-us/library/ms646310%28v=vs.85%29.aspx

So, basically, there are two functions in C++ to simulate this :   SendInput() or keybd_event()
Maybe you should play around with them and see how it goes.

Best of luck  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


henry

Expertise

I can confidently answer any question both basic and advanced in C++. Areas like templates, algorithms, Gui and design patterns are of interest to me. i will not answer questions about web programming.

Experience

I have a 3- year- work experience in software Engineering.

Education/Credentials
I am a bachelor of Engineering graduate

©2016 About.com. All rights reserved.