Beispiel #1
0
        public static IntPtr GetWnd(Int32 pID, String text)
        {
            IntPtr h = DLLInclude.GetTopWindow(IntPtr.Zero);

            while (h != IntPtr.Zero)
            {
                UInt32 newID;
                DLLInclude.GetWindowThreadProcessId(h, out newID);
                if (newID == pID)
                {
                    StringBuilder sbClassName = new StringBuilder(200);
                    StringBuilder sbText      = new StringBuilder(200);

                    DLLInclude.GetClassName(h, sbClassName, 200);
                    DLLInclude.GetWindowText(h, sbText, 200);
                    if (sbText.ToString().IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0)
                    {
                        break;
                    }
                }

                h = DLLInclude.GetWindow(h, DLLInclude.GW_HWNDNEXT);
            }

            return(h);
        }
Beispiel #2
0
 public static bool BackWindow(IntPtr hwnd)
 {
     if (hwnd != IntPtr.Zero)
     {
         if (DLLInclude.SetWindowPos(hwnd, -1, 0, 0, 0, 0, 0x0080 | 0x0010))
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #3
0
 public static bool ForwardWindow(IntPtr hwnd)
 {
     if (hwnd != IntPtr.Zero)
     {
         DLLInclude.ShowWindow(hwnd, 1);
         DLLInclude.SetWindowPos(hwnd, -1, 0, 0, 0, 0, 1 | 2);
         DLLInclude.RECT rectHwnd;
         DLLInclude.GetWindowRect(hwnd, out rectHwnd);
         DLLInclude.MoveWindow(hwnd, 0, 0, rectHwnd.Right - rectHwnd.Left, rectHwnd.Bottom - rectHwnd.Top, true);
     }
     return(true);
 }
Beispiel #4
0
        public static Bitmap ALT(IntPtr hwnd)
        {
            DLLInclude.RECT rectHwnd;
            DLLInclude.GetWindowRect(hwnd, out rectHwnd);
            Bitmap   myImage = new Bitmap(rectHwnd.Right - rectHwnd.Left, rectHwnd.Bottom - rectHwnd.Top);
            Graphics gr      = Graphics.FromImage(myImage);

            gr.CopyFromScreen(new Point(rectHwnd.Left, rectHwnd.Top), new Point(0, 0), new Size(rectHwnd.Right - rectHwnd.Left, rectHwnd.Bottom - rectHwnd.Top));
            Bitmap bitImage = myImage;

            return(bitImage);
        }
Beispiel #5
0
        public static bool OutScreen(IntPtr hwnd)
        {
            Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;

            if (hwnd != IntPtr.Zero)
            {
                if (DLLInclude.MoveWindow(hwnd, rect.Width, rect.Height, 1032, 815, true))
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #6
0
 public static bool CheckHwnd(string name, ref IntPtr hwnd)
 {
     while (hwnd == IntPtr.Zero)
     {
         Thread.Sleep(10);
         hwnd = DLLInclude.FindWindow(null, name);
     }
     if (hwnd != IntPtr.Zero)
     {
         Form1.MainHwnd = hwnd;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #7
0
 void unreg_hotkey()
 {
     DLLInclude.UnregisterHotKey(this.Handle, 80);
     DLLInclude.UnregisterHotKey(this.Handle, 90);
 }
Beispiel #8
0
 void reg_hotkey()
 {
     DLLInclude.RegisterHotKey(this.Handle, 80, 0, Keys.F8);
     DLLInclude.RegisterHotKey(this.Handle, 90, 0, Keys.F9);
 }