public MacroEvent_Mouse(MouseEvent _event, eMouseButton _button) { Event = _event; Button = _button; INPUT keyInput = new INPUT(); keyInput.type = 0; MOUSEINPUT mInput = new MOUSEINPUT(); eMouseCommand command = eMouseCommand.Move; if (Button == eMouseButton.LDOWN) command = eMouseCommand.LDown; if (Button == eMouseButton.LUP) command = eMouseCommand.LUp; if (Button == eMouseButton.RDOWN) command = eMouseCommand.RDown; if (Button == eMouseButton.RUP) command = eMouseCommand.RUp; if (Button == eMouseButton.MWheel) command = eMouseCommand.MWheel; if (Button == eMouseButton.MHWheel) command = eMouseCommand.HWHeel; mInput.dx = 0; mInput.dy = 0; mInput.mouseData = Event.mouseData; mInput.time = 0; mInput.dwExtraInfo = Event.extraInfo; mInput.dwFlags = (uint)command; keyInput.iUinion.mi = mInput; InputList[0] = keyInput; inputSize = Marshal.SizeOf(InputList[0]); }
public MacroEvent_Keyboard(eKeyboardEvent _eType, KeyboardEvent _event) { EventType = _eType; Event = _event; uint keyState = Convert.ToUInt32(EventType == eKeyboardEvent.KeyDown ? 0 : 0x2); INPUT keyInput = new INPUT(); keyInput.type = 1; KEYBDINPUT kbInput = new KEYBDINPUT(); kbInput.wVk = Convert.ToUInt16(Event.vKeyCode); kbInput.wScan = Convert.ToUInt16(Event.scanCode); kbInput.dwFlags = keyState; kbInput.time = 0; kbInput.dwExtraInfo = Event.dwExtraInfo; keyInput.iUinion.ki = kbInput; InputList[0] = keyInput; inputSize = Marshal.SizeOf(InputList[0]); }