Home > Software engineering >  How to write a simulated keyboard function
How to write a simulated keyboard function

Time:09-17

Consult, c + + do a keyboard simulator, but set the key not reflected in the game, how to solve this problem?
Seems to have blocked the mechanism simulation game, is there a better way of

# include "stdafx. H"
H # include "Windows."

Void SetNumLock (BOOL bState)
{
BYTE keyState [256].

//GetKeyboardState ((LPBYTE) & amp; KeyState);
//if ((bState & amp; & ! (keyState [VK_NUMLOCK] & amp; 1) | |
//(! BState & amp; & (keyState [VK_NUMLOCK] & amp; 1)))
{
//Simulate a key press
X53 keybd_event (0,
0 x1f,
KEYEVENTF_EXTENDEDKEY | 0,
0);

//Simulate a key release
X53 keybd_event (0,
0 x1f,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}
}

Void main ()
{
Int a=5000;
Sleep (a);
SetNumLock (TRUE);
}

CodePudding user response:

WinIo driver stage keyboard simulation programming

CodePudding user response:

Usb interface, general

CodePudding user response:

Drive a manipulator by the keyboard and click/moving the mouse!

CodePudding user response:

Some D3D games that require keybd_event the second parameter is set correctly.
For example: keybd_event (vitamin k, MapVirtualKey (vitamin k, 0), dwFlags, NULL);

CodePudding user response:

Keybd_event function
For example, by pressing the enter key keybd_event (13, MapVirtualKeyA (13, 0), 0, 0).
Pop-up keybd_event (13, MapVirtualKeyA (13, 0), KEYEVENTF_KEYUP, 0).

The key of the enter key Value Value

MapVirtualKeyA himself baidu

CodePudding user response:

A lot of games in order to prevent external banned the simulation
Drive Ring0, Suggestions on the Internet with this tutorial

CodePudding user response:

R3 layer is generally blocked, r0 virtual device itself too much trouble, it is better to buy a keyboard macros
  • Related