Hello. I wanted to ask for help in the next question: how to emulate Alt + NumPad * input?
I have an XML file with instructions, ala:
<Action Name="KeyDown" Key="ALT"> <Action Name="KeyDown" Key="NUMPAD1"> <Action Name="KeyUp" Key="NUMPAD1"> <Action Name="KeyDown" Key="NUMPAD2"> <Action Name="KeyUp" Key="NUMPAD2"> <Action Name="KeyUp" Key="ALT"> These instructions are read and, for each Action, an INPUT is created, which is sent by WinAPI:
WinAPI.INPUT action = new WinAPI.INPUT(); action.Type = (UInt32)SendInputEventType.InputKeyboard; action.Data.Keyboard = new WinAPI.KEYBDINPUT((uint)_action, (ushort)_key); WinAPI.SendInput(1, new WinAPI.INPUT[] { action }, System.Runtime.InteropServices.Marshal.SizeOf(action)); Constructor KEYBDINPUT:
public KEYBDINPUT(uint action, ushort key) { Vk = key; Scan = 0; Time = 0; Flags = action; ExtraInfo = IntPtr.Zero; } Key combinations: Ctrl + A, Ctrl + C, Ctrl + V, work, and Alt + NUMPAD - does not enter anything.
I tried using Scan, with the help of a scan code and the KEYEVENTF_SCANCODE flag. It turned out exactly the same.
I tried to memorize the whole combination and send it as a list, but I stopped displaying anything at all. I do not think that the problem is this, because the rest of the combinations work.