简体   繁体   中英

How do I create a program that presses a key in C++?

I am trying to create a macro program in C++. The program is supposed to press the H key once in every 10 seconds. I have got the timing functions already, but how do I make it hit a key? So while the program runs, if I go to Notepad and leave it there, it would type "hhhhhhhh(...)"

Thanks!

A quick search turns up this question has been answered before: How to simulate a key press in C++

Their accepted answer was to use SendInput()

It completely depends on your idea in mind, but i personnaly find that if i want to make some kind of macro program AutoIt is THE way to go.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM