Exemple #1
0
 private static WinApi.INPUT MakeKeyInput(Keys vkCode, bool isDown, bool isScan)
 {
     return(new WinApi.INPUT
     {
         type = WinApi.INPUT_KEYBOARD,
         ki = new WinApi.KEYBOARD_INPUT
         {
             wVk = isScan ? (ushort)0 : (ushort)vkCode,
             wSc = isScan ? (ushort)WinApi.MapVirtualKey((uint)vkCode, WinApi.MAPVK_VK_TO_VSC) : (ushort)0,
             Flags = (isScan ? WinApi.KEYEVENTF_SCANCODE :
                      (IsExtendedKey(vkCode) ? WinApi.KEYEVENTF_EXTENDEDKEY : 0))
                     | (isDown ? 0 : WinApi.KEYEVENTF_KEYUP),
             Time = 0,
             dwExtraInfo = 0
         }
     });
 }