public static IntPtr SimulateAltKeyPress(IntPtr handle) { Pinvokes.SendMessage(handle, (int)WM.SyskeyDown, 0x12, 0x20380001); Pinvokes.SendMessage(handle, (int)WM.SyskeyUp, 0x12, 0xC0380001); return(IntPtr.Zero); }
public static int SendMessage(IntPtr hwnd, int msg, uint wParam, uint lParam) { int lastError = 0; if (Pinvokes.SendMessage(hwnd, msg, wParam, lParam) != IntPtr.Zero) { lastError = Marshal.GetLastWin32Error(); string lastErrorMessage = new Win32Exception(lastError).Message; Logger.Error($"SendMessage failed with {lastError}: \"{lastErrorMessage}\""); } return(lastError); }
public static IntPtr InvokeMouse(IntPtr handle, int msg, uint x, uint y) { return(Pinvokes.SendMessage(handle, msg, 0, MakeLParam(x, y))); }
public static IntPtr InvokeSysKeyUp(IntPtr handle, uint key) { return(Pinvokes.SendMessage(handle, (int)WM.SyskeyUp, key, 1)); }
public static IntPtr InvokeKeyDown(IntPtr handle, uint key) { return(Pinvokes.SendMessage(handle, (int)WM.KeyDown, key, 0)); }