예제 #1
0
 /// <summary>
 /// SendInput Win32APIをラップしたメソッド
 /// </summary>
 /// <param name="inputs"></param>
 public static void SendInput(INPUT[] inputs)
 {
     for (Int32 i = 0; i < inputs.Length; i++)
     {
         INPUT input = inputs[i];
         if (input.type == type.INPUT_KEYBOARD)
         {
             //キーボードの時は変換が必要らしい
             //input.ki.wScan = (Int16)input.ki.wVk;//(Int16)(MapVirtualKey((Int32)input.ki.wVk, 0));
             input.ki.dwExtraInfo = GetMessageExtraInfo();
             input.ki.dwFlags = ExtendedKeyFlagW(input.ki.wVk) | input.ki.dwFlags;
         }
     }
     SendInput(inputs.Length, inputs, Marshal.SizeOf(inputs[0]));
 }
예제 #2
0
 public static extern uint SendInput(uint nInputs, ref INPUT pInputs, int cbSize);
예제 #3
0
 private extern static Int32 SendInput(Int32 nInputs, INPUT[] pInputs, Int32 cbSize);
예제 #4
0
 public static void SendInput(INPUT input)
 {
     input.ki.dwExtraInfo = GetMessageExtraInfo();
     input.ki.dwFlags = ExtendedKeyFlagW(input.ki.wVk) | input.ki.dwFlags;
     SendInput(1, ref input, Marshal.SizeOf(input));
 }