Created
October 5, 2017 23:14
-
-
Save Batname/e1e192ae8353f82bbcec245c2b2e4390 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define WINVER 0x0500 | |
#include <windows.h> | |
void ToogleRecordingKeys() | |
{ | |
// This structure will be used to create the keyboard | |
// input event. | |
INPUT ipAlt; | |
INPUT ipF9; | |
// Set up a generic keyboard event. | |
ipAlt.type = INPUT_KEYBOARD; | |
ipAlt.ki.wScan = 0; // hardware scan code for key | |
ipAlt.ki.time = 0; | |
ipAlt.ki.dwExtraInfo = 0; | |
// Set up a generic keyboard event. | |
ipF9.type = INPUT_KEYBOARD; | |
ipF9.ki.wScan = 0; // hardware scan code for key | |
ipF9.ki.time = 0; | |
ipF9.ki.dwExtraInfo = 0; | |
// Press the "ALT" key | |
ipAlt.ki.wVk = 0x12; // virtual-key code for the "a" key | |
ipAlt.ki.dwFlags = 0; // 0 for key press | |
SendInput(1, &ipAlt, sizeof(INPUT)); | |
// Press the "F9" key | |
ipF9.ki.wVk = 0x78; // virtual-key code for the "a" key | |
ipF9.ki.dwFlags = 0; // 0 for key press | |
SendInput(1, &ipF9, sizeof(INPUT)); | |
// Release the "ALT" key | |
ipAlt.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | |
SendInput(1, &ipAlt, sizeof(INPUT)); | |
// Release the "F9" key | |
ipF9.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | |
SendInput(1, &ipF9, sizeof(INPUT)); | |
} | |
// Pause for 10 seconds of video. | |
int main() | |
{ | |
ToogleRecordingKeys(); | |
Sleep(10000); | |
ToogleRecordingKeys(); | |
// Exit normally | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment