// }}} public void KeyUp(KeyMap CurrentKey, string ExtraData = "") // SPECIAL KEY {{{ { KMH_INPUT input_up = new KMH_INPUT(); switch (CurrentKey.KeyCode) { case 0: // Left Mouse Button {{{ //mouse_event(0x04, 0, 0, 0, 0); input_up.type = INPUT_MOUSE; input_up.mi.dx = 0; input_up.mi.dy = 0; input_up.mi.mouseData = 0; input_up.mi.dwFlags = (int)MOUSEEVENTF_LEFTUP; break; //}}} case 1: // Right Mouse Button {{{ input_up.type = INPUT_MOUSE; input_up.mi.dx = 0; input_up.mi.dy = 0; input_up.mi.mouseData = 0; input_up.mi.dwFlags = (int)MOUSEEVENTF_RIGHTUP; break; //}}} case 2: // Middle Mouse Button {{{ input_up.type = INPUT_MOUSE; input_up.mi.dx = 0; input_up.mi.dy = 0; input_up.mi.mouseData = 0; input_up.mi.dwFlags = (int)MOUSEEVENTF_MIDDLEUP; break; //}}} default: // Special-Key that can be sent just with the SpecialValue to the Keyboard Input {{{ input_up.type = INPUT_KEYBOARD; input_up.ki.wVk = _SpecialKeys[CurrentKey.KeyCode].SpecialValue; input_up.ki.wScan = 0; input_up.ki.dwExtraInfo = IntPtr.Zero; input_up.ki.dwFlags = KEYEVENTF_KEYUP; break; //}}} } KMH_INPUT[] inputs = { input_up }; NativeMethods.SendInput(1, inputs, Marshal.SizeOf(input_up)); }
// }}} public void KeyDown(KeyMap CurrentKey, string ExtraData = "") // SPECIAL KEY PRESSED {{{ { KMH_INPUT input = new KMH_INPUT(); switch (CurrentKey.KeyCode) { case 0: // Left Mouse Button //{{{ //Old Code - Mostly Worked //mouse_event(0x02, 0, 0, 0, 0); input.type = INPUT_MOUSE; input.mi.dx = 0; input.mi.dy = 0; input.mi.mouseData = 0; input.mi.dwFlags = (int)MOUSEEVENTF_LEFTDOWN; break; //}}} case 1: // Right Mouse Button //{{{ input.type = INPUT_MOUSE; input.mi.dx = 0; input.mi.dy = 0; input.mi.mouseData = 0; input.mi.dwFlags = (int)MOUSEEVENTF_RIGHTDOWN; break; //}}} case 2: // Middle Mouse Button //{{{ input.type = INPUT_MOUSE; input.mi.dx = 0; input.mi.dy = 0; input.mi.mouseData = 0; input.mi.dwFlags = (int)MOUSEEVENTF_MIDDLEDOWN; break; //}}} case 3: // Mouse Vertical Scroll //{{{ input.type = INPUT_MOUSE; input.mi.dx = 0; input.mi.dy = 0; //Check to see if scrolling Up or down if (CurrentKey.KeyData == "1") { input.mi.mouseData = 100; } else { input.mi.mouseData = -100; } input.mi.dwFlags = (int)MOUSEEVENTF_VWHEEL; break; //}}} case 4: // Mouse Horizontal Scroll //{{{ input.type = INPUT_MOUSE; input.mi.dx = 0; input.mi.dy = 0; //Check to see if scrolling Up or down if (CurrentKey.KeyData == "1") { input.mi.mouseData = 100; } else { input.mi.mouseData = -100; } input.mi.dwFlags = (int)MOUSEEVENTF_HWHEEL; break; //}}} /* case 5: // Media Play/Pause //{{{ * input.ki.wVk = (ushort)MEDIA_PLAY_PAUSE; * input.ki.wScan = 0; * input.ki.dwExtraInfo = IntPtr.Zero; * input.ki.dwFlags = 0; * * break; * //}}} */ default: // Special-Key that can be sent just with the SpecialValue to the Keyboard Input //{{{ log("SpecialKeyPlayer.KeyDown(" + CurrentKey.ToString() + ")"); log("..."); input.type = INPUT_KEYBOARD; input.ki.wVk = _SpecialKeys[CurrentKey.KeyCode].SpecialValue; input.ki.wScan = 0; input.ki.dwExtraInfo = IntPtr.Zero; input.ki.dwFlags = 0; break; //}}} } KMH_INPUT[] inputs = { input }; NativeMethods.SendInput(1, inputs, Marshal.SizeOf(input)); }