VGamepad PC
The Windows app for the virtual game controller.
Loading...
Searching...
No Matches
keyboardSim.cpp File Reference
#include "keyboardSim.hpp"
#include <unordered_set>
Include dependency graph for keyboardSim.cpp:

Functions

void addScanCode (INPUT &input, WORD key)
 Adds the scan code to the input structure.
 
void pressKey (WORD key)
 
void pressKeyCombo (std::vector< WORD > keys)
 
void keyDown (WORD key)
 
void keyUp (WORD key)
 
void keyComboUp (std::vector< WORD > keys)
 
void keyComboDown (std::vector< WORD > keys)
 
void typeUnicodeString (std::wstring str)
 

Variables

static const std::unordered_set< WORD > extendedKeys
 

Function Documentation

◆ addScanCode()

void addScanCode ( INPUT & input,
WORD key )
inline

Adds the scan code to the input structure.

This is necessary because some apps and games use the scan code to determine the actual location of the key on the keyboard. The difference becomes vital when using non-QWERTY keyboard layouts.

◆ keyComboDown()

void keyComboDown ( std::vector< WORD > keys)

◆ keyComboUp()

void keyComboUp ( std::vector< WORD > keys)

◆ keyDown()

void keyDown ( WORD key)

◆ keyUp()

void keyUp ( WORD key)

◆ pressKey()

void pressKey ( WORD key)

◆ pressKeyCombo()

void pressKeyCombo ( std::vector< WORD > keys)

◆ typeUnicodeString()

void typeUnicodeString ( std::wstring str)

Variable Documentation

◆ extendedKeys

const std::unordered_set<WORD> extendedKeys
static
Initial value:
= {
VK_RMENU, VK_RCONTROL, VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT,
VK_RIGHT, VK_UP, VK_LEFT, VK_DOWN, VK_NUMLOCK, VK_CANCEL, VK_SNAPSHOT, VK_DIVIDE}

Extended key lookup table. Reference: https://learn.microsoft.com/en-us/windows/win32/inputdev/about-keyboard-input#extended-key-flag