Click here to Skip to main content
15,884,388 members
Articles / Desktop Programming / Win32

Simulate a keystroke in windows

Rate me:
Please Sign up or sign in to vote.
3.79/5 (16 votes)
22 Feb 2011CPOL 40.7K   8  
This tip shows how to simulate a key stroke in windows environment

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
1 Sep 2011Jose David Pujo
With SendInput:void SetNumLock (bool active){ BYTE keyState[256]; GetKeyboardState((LPBYTE)&keyState); bool active0= keyState[VK_NUMLOCK] & 1; if (active0!=active) { INPUT inp[2]; ZeroMemory(inp, sizeof(inp)); inp[0].type=INPUT_KEYBOARD; ...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead Kotha Technologies
Bangladesh Bangladesh
If you are not in - you are out !
- Chapter 1

Comments and Discussions