Home > Software engineering >  C simulate keystrokes
C simulate keystrokes

Time:10-08

Want to write a background simulation using SendMessage function keys (refer to the run-time binding window can be minimized), press F10, binding a window, and press the space key, the time interval between each key can adjust themselves in the window, until the press F12 stops, the key part is very simple, but I don't know how to use F10 start and stop F12 loop exits, consult everybody, thank you first

CodePudding user response:

Top one yourself

CodePudding user response:

CodePudding user response:

The program you minimize (not binding window)?
Without minimizing, detect button F10 began to cycle, cycle of constantly judging an indicator variable, if the flag is true will exit the loop and loop response system messages, unceasingly in order to have a key message F12 can perform,
Detect button F12 change flag variable has a value of true,

If your program is to minimize, may need to Hook to detect button F10 and F12,

CodePudding user response:

http://blog.csdn.net/love3s/article/details/7851887

CodePudding user response:

Thank upstairs for the train of thought, now I'm a start, the software window does not respond, don't know what the devil

CodePudding user response:

Loop to response system messages,
What do you use to programming?

CodePudding user response:

Otherwise the long cycle can make the UI freeze,

CodePudding user response:

With VC6

CodePudding user response:

http://www.autohotkey.com

CodePudding user response:

The
reference 5 floor b330225 response:
thank upstairs for the train of thought, now I'm a start, the software window does not respond, don't know what the devil

If you use a cycle, it needs to put a sleep statement within the loop, let the system response time,

CodePudding user response:

Don't response because written message loop in the main thread, a start on that always do news cycle, the main interface will be stuck

CodePudding user response:

In the infinite loop to add
 
Void DoEvents ()
{
MSG MSG.
//Process existing messages in the application's message queue.
//When the queue is empty, do the clean up and return.
While (: : PeekMessage (& amp; MSG, NULL, 0, 0, PM_NOREMOVE))
{//from the MSG
if (! AfxGetThread () - & gt; PumpMessage break ());
}
}

CodePudding user response:

Registration system hotkey RegisterHotKey

CodePudding user response:

System hotkey most reasonable use registration, the registry F10 to start button, F12 for the stop button,
It is important to note that send keys must be placed in a worker thread POSTMESSAGE, otherwise you'll be engaged the main thread, is what do not come,
  • Related