0

I am trying to simulate inputs from a chsarp app to a remote desktop session. It s working well for any key but I can't get special keys to work. Especially I m trying CTRL+A . I have tried with InputSimulator but it didnt work even if Mouse and TextEntry does work though. So I tried with keybd_event().

public const int KEYEVENTF_EXTENDEDKEY = 0x0001; //Key down flag
public const int KEYEVENTF_KEYUP = 0x0002; //Key up flag
public const int VK_LCONTROL = 0xA2; //Left Control key code
public const int A = 0x41; //A key code
public const int C = 0x43; //C key code
public const int V = 0x56; // V key code
keybd_event(0x11, 0x9d, 0, 0); // Ctrl Press
keybd_event(0x41, 0x9e, 0, 0); // ‘A’ Press
keybd_event(0x41, 0x9e, KEYEVENTF_KEYUP, 0); // ‘A’ Release
keybd_event(0x11, 0x9d, KEYEVENTF_KEYUP, 0); // Ctrl Release

This code will type a "q"...maybe an azerty/werty issue though but I tried with "v"(instead of "a") too and it type a "v" rather than ctr+v :((

Thanks

user3497492
  • 265
  • 3
  • 11
  • Does this help? https://stackoverflow.com/questions/27187004/send-special-keys-over-remote-desktop –  Jun 15 '17 at 01:00
  • yes thanks I had seen it. ut there is an issue there (cant release special keys) which has never been resolved so I hoped for a clean way... – user3497492 Jun 15 '17 at 07:53

0 Answers0