Created
January 4, 2024 07:33
-
-
Save ObserverHerb/8c63e8c49383d8d047340ed81d298cdd to your computer and use it in GitHub Desktop.
Open On-Screen Keyboard Programmatically in Windows
This file contains hidden or 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
#include <Windows.h> | |
int main() | |
{ | |
INPUT input[3]; | |
input[0].type = INPUT_KEYBOARD; | |
input[0].ki.wScan = 0; | |
input[0].ki.time = 0; | |
input[0].ki.dwExtraInfo = 0; | |
input[0].ki.wVk = 0x11; | |
input[0].ki.dwFlags = 0; | |
input[1].type = INPUT_KEYBOARD; | |
input[1].ki.wScan = 0; | |
input[1].ki.time = 0; | |
input[1].ki.dwExtraInfo = 0; | |
input[1].ki.wVk = 0x5B; | |
input[1].ki.dwFlags = 0; | |
input[2].type = INPUT_KEYBOARD; | |
input[2].ki.wScan = 0; | |
input[2].ki.time = 0; | |
input[2].ki.dwExtraInfo = 0; | |
input[2].ki.wVk = 0x4F; | |
input[2].ki.dwFlags = 0; | |
SendInput(3, input, sizeof(INPUT)); | |
input[0].ki.dwFlags = KEYEVENTF_KEYUP; | |
input[1].ki.dwFlags = KEYEVENTF_KEYUP; | |
input[2].ki.dwFlags = KEYEVENTF_KEYUP; | |
SendInput(3, input, sizeof(INPUT)); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment