private void RaiseCard(List <int> Card) { SetWinHook.StopHook = true; WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.D5, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.D5, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); NextRoad(); /* * WinApi.keybd_event(Keys.A, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); * WinApi.keybd_event(Keys.A, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); * WinApi.keybd_event(Keys.E, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); * WinApi.keybd_event(Keys.E, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); * */ foreach (int k in Card) { RaiseKeyEvent(GetKeyByInt(k)); } WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Oem2, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Oem2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); WinApi.keybd_event(Keys.Return, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Return, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); SetWinHook.StopHook = false; }
static private void NextRoad() { WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Oem2, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Oem2, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); WinApi.keybd_event(Keys.LShiftKey, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); WinApi.keybd_event(Keys.Oem1, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(Keys.Oem1, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); }
internal void RaiseHookedKeys() { StopHook = true; foreach (Keys k in HookedKeys) { WinApi.keybd_event(k, 0, WinApi.KEYEVENTF_EXTENDEDKEY | WinApi.WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(k, 0, WinApi.KEYEVENTF_EXTENDEDKEY | WinApi.KEYEVENTF_KEYUP, (IntPtr)0); } HookedKeys.Clear(); StopHook = false; }
public void RaiseKeyEvent(Keys K) { WinApi.keybd_event(K, 0, KEYEVENTF_EXTENDEDKEY | WM_KEYDOWN, (IntPtr)0); WinApi.keybd_event(K, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (IntPtr)0); }