Exemplo n.º 1
0
 private void btnBottom_Click(object sender, EventArgs e)
 {
     if (testhWnd != IntPtr.Zero)
     {
         User32Utils.SetWindowPos(testhWnd, (int)hWndInsertAfterType.HWND_BOTTOM, 0, 0, 0, 0, 1 | 2);
     }
 }
Exemplo n.º 2
0
 private void btnMin_Click(object sender, EventArgs e)
 {
     if (testhWnd != IntPtr.Zero)
     {
         User32Utils.ShowWindow(testhWnd, 2);//隐藏本dos窗体, 0: 后台执行;1:正常启动;2:最小化到任务栏;3:最大化
     }
 }
Exemplo n.º 3
0
 private void btnTopMost_Click(object sender, EventArgs e)
 {
     if (testhWnd != IntPtr.Zero)
     {
         User32Utils.SetWindowPos(testhWnd, (int)hWndInsertAfterType.HWND_TOPMOST, 0, 0, 0, 0, 1 | 2);
     }
 }
Exemplo n.º 4
0
 protected override void CreateHandle()
 {
     base.CreateHandle();
     // Note: We need this because the Form.TopMost property does not respect
     // the "ShowWithoutActivation" flag, meaning the window will steal the
     // focus every time it is made visible.
     User32Utils.SetTopMost(new HandleRef(this, Handle), true);
 }
Exemplo n.º 5
0
 private void btnFindWindow_MouseMove(object sender, MouseEventArgs e)
 {
     if (isMouseUp)                                            //左键是否被按下
     {
         User32Utils.GetCursorPos(ref pi);                     //获取鼠标坐标值
         lblLocation.Text = "坐标:X=" + pi.X + "  |  Y=" + pi.Y; //label1显示鼠标坐标值的x值与y值
         testhWnd         = User32Utils.WindowFromPoint(pi);
         ShowWinInfo(testhWnd);
     }
 }
Exemplo n.º 6
0
 private void btnRunSoftware_Click(object sender, EventArgs e)
 {
     testhWnd = new IntPtr(0);
     Thread.Sleep(500);
     testhWnd = User32Utils.FindWindow(txthWindClassName.Text, null);
     if (testhWnd == IntPtr.Zero)
     {
         testhWnd = User32Utils.FindWindow(null, txthWindClassName.Text);
     }
     ShowWinInfo(testhWnd);
 }
Exemplo n.º 7
0
 private void btnnMoveRight_Click(object sender, EventArgs e)
 {
     if (testhWnd != IntPtr.Zero)
     {
         RECT rect = new RECT();
         User32Utils.GetWindowRect(testhWnd, out rect);
         int  width   = rect.Right - rect.Left; /* 高 */
         int  height  = rect.Bottom - rect.Top; /* 宽 */
         RECT rectNew = new RECT(rect.Left + 10, rect.Top, rect.Right, rect.Bottom);
         User32Utils.MoveWindow(testhWnd, rectNew.Left, rectNew.Top, rect.Width, rect.Height, true);
     }
 }
Exemplo n.º 8
0
        private void ShowWinInfo(IntPtr hWnd)
        {
            StringBuilder lpString = new StringBuilder(256);

            txtMainWindowHandle.Text = testhWnd.ToString();

            User32Utils.GetWindowText(testhWnd, lpString, 256);
            txtTitle.Text = lpString.ToString();

            User32Utils.GetClassName(testhWnd, lpString, 256);
            txtClassName.Text = lpString.ToString();
        }
 public static void ReReadRegistry()
 {
     User32Utils.Notify_SettingChange();
 }
Exemplo n.º 10
0
 public void SelectAllItems(IntPtr handle)
 {
     User32Utils.SelectAllItems(handle);
 }