示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public static IntPtr InvokeMouse(IntPtr handle, int msg, uint x, uint y)
 {
     return(Pinvokes.SendMessage(handle, msg, 0, MakeLParam(x, y)));
 }
示例#4
0
 public static IntPtr InvokeSysKeyUp(IntPtr handle, uint key)
 {
     return(Pinvokes.SendMessage(handle, (int)WM.SyskeyUp, key, 1));
 }
示例#5
0
 public static IntPtr InvokeKeyDown(IntPtr handle, uint key)
 {
     return(Pinvokes.SendMessage(handle, (int)WM.KeyDown, key, 0));
 }