MCPcopy Create free account
hub / github.com/cafali/SnapKey / SendKey

Function SendKey

SnapKey.cpp:201–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199bool isSimulatedKeyEvent(DWORD flags) { return flags & 0x10; }
200
201void SendKey(int targetKey, bool keyDown) {
202 INPUT input = {0};
203 input.ki.wVk = targetKey;
204 input.ki.wScan = MapVirtualKey(targetKey, 0);
205 input.type = INPUT_KEYBOARD;
206
207 DWORD flags = KEYEVENTF_SCANCODE;
208 input.ki.dwFlags = keyDown ? flags : flags | KEYEVENTF_KEYUP;
209 SendInput(1, &input, sizeof(INPUT));
210}
211
212LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam) {
213 if (!isLocked && nCode >= 0) {

Callers 2

handleKeyDownFunction · 0.85
handleKeyUpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected