/// <summary> /// Send a Virtual Key to FFXIV /// </summary> /// <param name="key">Virtual Key to press</param> /// <param name="keyup">Should we keypress up (default: true)</param> /// <param name="delay">Delay between keydown and keyup (default: 100ms)</param> public void SendKeyPress(VKKeys key, bool keyup = true, int delay = 100) { PostMessage(_ffxivWindow, WM_KEYDOWN, (IntPtr)key, IntPtr.Zero); if (keyup) { Thread.Sleep(delay); PostMessage(_ffxivWindow, WM_KEYUP, (IntPtr)key, IntPtr.Zero); } }
public void ToggleKeyState(VKKeys key, bool keydown = true) { if (keydown) { PostMessage(_ffxivWindow, WM_KEYDOWN, (IntPtr)key, IntPtr.Zero); } else { PostMessage(_ffxivWindow, WM_KEYUP, (IntPtr)key, IntPtr.Zero); } }
/// <summary> /// Send a Virtual Key to FFXIV /// </summary> /// <param name="key">Virtual Key to press</param> /// <param name="keyup">Should we keypress up (default: true)</param> /// <param name="delay">Delay between keydown and keyup (default: 100ms)</param> public void SendKeyPress(VKKeys key, bool keyup = true, int delay = 100) { PostMessage(_ffxivWindow, WM_KEYDOWN, key, 0); if (keyup) { Thread.Sleep(delay); PostMessage(_ffxivWindow, WM_KEYUP, key, 0); } }
//static extern bool PostMessage (HandleRef hWnd, uint Msg, IntPtr wParam, IntPtr lParam); private static extern bool PostMessage(IntPtr hWnd, uint msg, VKKeys wParam, Int32 lParam);
public void ToggleKeyState(VKKeys key, bool keydown = true) { if (keydown) PostMessage (_ffxivWindow, WM_KEYDOWN, (IntPtr)key, IntPtr.Zero); else PostMessage (_ffxivWindow, WM_KEYUP, (IntPtr)key, IntPtr.Zero); }