What should I use to automate DirectX applications from C # code? I would like to send messages with keys and mouse to a DirectX game from a C # application. I tried pInvoke solutions to no avail, having code like
INPUT[] InputData = new INPUT[1];
InputData[0].type = (UInt32)InputType.KEYBOARD;
InputData[0].ki.wScan = (ushort)0x041e;
InputData[0].ki.dwFlags = (uint)KeyboardFlag.SCANCODE;
InputData[0].ki.time = 0;
InputData[0].ki.dwExtraInfo = 0;
SendInput(1, ref InputData[0], Marshal.SizeOf(InputData[0]));
INPUT[] InputData1 = new INPUT[1];
InputData1[0].type = (UInt32)InputType.KEYBOARD;
InputData1[0].ki.wScan = (ushort)0x041e;
InputData1[0].ki.dwFlags = (uint)KeyboardFlag.KEYUP | (uint)KeyboardFlag.SCANCODE;
InputData1[0].ki.time = 0;
InputData1[0].ki.dwExtraInfo = 0;
SendInput(1, ref InputData1[0], Marshal.SizeOf(InputData1[0]));
work well with standard desktop applications, but silently do not perform any actions in the DirectX application. Please tell me what else I should try. I discovered and tested with the same poor results several automation libraries that can be used with C # - they all work well in GDI + applications, cannot achieve results in DirectX applications. Is there any automation infrastructure specifically designed for DirectX applications that I could link to in C # in my code?