Пример #1
0
        private static Icon GetWindowIcon(IntPtr handle)
        {
            if (MessagingMethods.SendMessageTimeout(
                    handle,
                    Wm.Geticon,
                    new IntPtr(0),
                    new IntPtr(0),
                    MessagingMethods.SendMessageTimeoutFlags.AbortIfHung | MessagingMethods.SendMessageTimeoutFlags.Block,
                    500,
                    out var hIcon) ==
                IntPtr.Zero)
            {
                hIcon = IntPtr.Zero;
            }

            Icon result = null;

            if (hIcon != IntPtr.Zero)
            {
                result = Icon.FromHandle(hIcon);
            }
            else
            {
                //Fetch icon from window class
                hIcon = WindowMethods.GetClassLong(handle, WindowMethods.ClassLong.Icon);

                if (hIcon.ToInt64() != 0)
                {
                    result = Icon.FromHandle(hIcon);
                }
            }

            return(result);
        }
Пример #2
0
        private static void InjectDoubleRightMouseClick(IntPtr child, NPoint clientLocation)
        {
            var lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, Wm.Rbuttondblclk, new IntPtr(Mk.Rbutton), lParamClickLocation);

            Log.Debug($"Double right click on window #{child} at {clientLocation}");
        }
Пример #3
0
        private static void InjectLeftMouseDown(IntPtr child, NPoint clientLocation)
        {
            IntPtr lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, WM.LBUTTONDOWN, new IntPtr(MK.LBUTTON), lParamClickLocation);
#if DEBUG
            System.Diagnostics.Debug.WriteLine("InjectLeftMouseDownMove #" + child.ToString() + " at " + clientLocation.ToString());
#endif
        }
Пример #4
0
        private static void InjectLeftMouseClick(IntPtr child, NPoint clientLocation)
        {
            var lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, Wm.Lbuttondown, new IntPtr(Mk.Lbutton), lParamClickLocation);
            MessagingMethods.PostMessage(child, Wm.Lbuttonup, new IntPtr(Mk.Lbutton), lParamClickLocation);

            Log.Debug($"Left click on window #{child} at {clientLocation}");
        }
Пример #5
0
        private static void InjectDoubleRightMouseClick(IntPtr child, NPoint clientLocation)
        {
            IntPtr lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, WM.RBUTTONDBLCLK, new IntPtr(MK.RBUTTON), lParamClickLocation);

#if DEBUG
            System.Diagnostics.Debug.WriteLine("Double right click on window #" + child.ToString() + " at " + clientLocation.ToString());
#endif
        }
Пример #6
0
        private static void InjectLeftMouseClick(IntPtr child, NPoint clientLocation)
        {
            IntPtr lParamClickLocation = MessagingMethods.MakeLParam(clientLocation.X, clientLocation.Y);

            MessagingMethods.PostMessage(child, WM.LBUTTONDOWN, new IntPtr(MK.LBUTTON), lParamClickLocation);
            MessagingMethods.PostMessage(child, WM.LBUTTONUP, new IntPtr(MK.LBUTTON), lParamClickLocation);
            //IntPtr lParamClickLocation2 = MessagingMethods.MakeLParam(clientLocation.X+100, clientLocation.Y+100);

            //MessagingMethods.PostMessage(child, WM.MOUSEMOVE, new IntPtr(MK.LBUTTON), lParamClickLocation2);
#if DEBUG
            System.Diagnostics.Debug.WriteLine("Left click on window #" + child.ToString() + " at " + clientLocation.ToString());
#endif
        }