Synthesizes keystrokes, mouse motions, and button clicks.
Questions tagged [sendinput]
251 questions
37
votes
3 answers
Send keys through SendInput in user32.dll
I am using this board as a keyboard for demo purposes.
Anyways to make the long story short everything works fine except for very few cases. I send keystrokes with the SendInput function located in user32.dll.
So my program looks like:
static void…

Tono Nam
- 34,064
- 78
- 298
- 470
20
votes
2 answers
C++ move mouse in windows using SetCursorPos
I created a device similar to a wiimote and i want to use it as a mouse in windows (8.1).
The device connects over tcp to a c++ win32 program on my windows computer and sends the position where the mouse cursor should move. I am using the…

user3394180
- 303
- 1
- 2
- 5
16
votes
2 answers
Simulating Keyboard with SendInput API in DirectInput applications
I'm trying to simulate keyboard commands for a custom game controller application. Because I'll need to simulate commands in a DirectInput environment most of the usual methods don't work. I know that using a hook would work 100% but I'm trying to…

Jason
- 391
- 1
- 2
- 8
15
votes
2 answers
Move Mouse to Position and Left Click
I'm working on an Windows Form Application in C#, Framework 4 (32 bit).
I have a list that holds coords of the mouse, and I can capture them. So far so good.
But at some point, I want to go to those coords and left mouse click on it.
This is how it…

Mathlight
- 6,436
- 17
- 62
- 107
14
votes
1 answer
Using SendInput to send unicode characters beyond U+FFFF
I'm writing an onscreen keyboard similar to the one in Windows 8. I have no problem sending most of the characters I need using Win32's SendInput.
The problem is when it comes to the new Windows 8 Emoji's. They start at U+1F600 using the Segoe UI…

headkaze
- 469
- 4
- 11
12
votes
2 answers
Can't send a single key function to remote desktop
After a really deep drill down the web, this is my code which unfortunately doesnt send the keys as upper case :/
MapVirtualKey Implementation:
const uint MAPVK_VK_TO_VSC = 0x00;
const uint MAPVK_VSC_TO_VK = 0x01;
const uint…

Nivo
- 131
- 1
- 7
11
votes
3 answers
SendInput() not equal to pressing key manually on keyboard in C++?
I wanted to write a c++ code to emulate pressing a keyboard key "A":
// Set up a generic keyboard event.
ip.type = INPUT_KEYBOARD;
ip.ki.wScan = 0; // hardware scan code for key
ip.ki.time = 0;
ip.ki.dwExtraInfo = 0;
// Press the "..."…

PolGraphic
- 3,233
- 11
- 51
- 108
11
votes
0 answers
SendInput fail because of UIPI
I am try to simulate mouse event on Win7, and my application using an open source project "Windows Input Simulator" on website http://inputsimulator.codeplex.com/ which internally use codes below to simulate mouse event:
[DllImport("user32.dll",…

Chen wei
- 151
- 1
- 6
11
votes
2 answers
Screen goes black when i use SendInput to send mouse cursor positions
I am using SendInput() to send relative positions of the mouse. First ill tel you what am doing.
i use my finger to move the mouse. So first i track my finger in a 640x480 image and get the absolute position in pixels with in the image.
then i send…

user2389323
- 769
- 2
- 10
- 22
10
votes
3 answers
SendInput and 64bits
Below is an extract of some code I am using to simulate key presses via the SendInput API. This works correctly if I set my application to compile for an x86 CPU, but doesn't work for x64 CPU compilation.
I'm guessing it has something todo with the…

Cheetah
- 13,785
- 31
- 106
- 190
7
votes
2 answers
SendInput() isn't "sending" the correct shifted characters?
void WriteChar(char c)
{
INPUT input = {0};
input.type = INPUT_KEYBOARD;
input.ki.wVk= VkKeyScanEx(c, GetKeyboardLayout(0) ) ;
SendInput(1,&input, sizeof(INPUT));
}
VkKeyScanEx returns different key codes for '/' and '?'(same…

Alex Gramatikov
- 71
- 1
- 3
7
votes
1 answer
SendInput() for keyboard - only lowercase
I have following code:
INPUT Input = { 0 };
Input.type = INPUT_KEYBOARD;
Input.mi.dwFlags = KEYEVENTF_EXTENDEDKEY;
Input.ki.wVk = 'A'; // tried 0x41, ( UCHAR )VkKeyScan( 'A' )
SendInput( 1, &Input, sizeof( INPUT ) );
but it generates me…

tobi
- 1,944
- 6
- 29
- 48
6
votes
1 answer
SendInput Not working for Games
I am using the following standard GenerateKey Code :
void GenerateKey ( int vk , BOOL bExtended)
{
KEYBDINPUT kb={0};
INPUT Input={0};
// generate down
if ( bExtended )
kb.dwFlags = KEYEVENTF_EXTENDEDKEY;
kb.wVk = vk;
…

Arnold
- 61
- 1
- 2
6
votes
1 answer
Pressing Win+X, Alt-Tab programmatically
I'm trying to simulate the keypress events for Win+X on Windows 8 which should pop up a small menu, but I have been unable to get this to work by using SendInput. For any other combination of keys (e.g. Win+R, Win+E, Win+D) it works but not for…

Maurice Gilden
- 1,934
- 1
- 12
- 16
5
votes
1 answer
How send unicode character to active application?
I need something like SendInput in Windows API.
I see this method, I don't know there is anyway to convert unicode character to virtual Key code.
CGEventRef CGEventCreateKeyboardEvent (
CGEventSourceRef source,
CGKeyCode virtualKey,
bool…

user486134
- 405
- 1
- 6
- 13