Exemplo n.º 1
0
 private void trackBar2_Scroll(object sender, EventArgs e)
 {
     wnd_Height.Text = trackBar2.Value.ToString();
     SpyWinAPI.MoveWindow(h, rect.Left, rect.Top,
                          Convert.ToInt32(wnd_Width.Text),
                          Convert.ToInt32(wnd_Height.Text),
                          true);
 }
Exemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("关闭窗体: " + wnd_Title.Text, "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (DialogResult.Yes == d)
            {
                SpyWinAPI.SendMessage(h, WM_CLOSE, 0, 0);
            }
        }
Exemplo n.º 3
0
 private void checkBox3_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox3.Checked)
     {
         SpyWinAPI.SetWindowPos(h, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
     }
     else
     {
         SpyWinAPI.SetWindowPos(h, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
     }
 }
Exemplo n.º 4
0
 private void checkBox2_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox2.Checked)
     {
         SpyWinAPI.EnableWindow(h, true);
     }
     else
     {
         SpyWinAPI.EnableWindow(h, false);
     }
 }
Exemplo n.º 5
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox1.Checked)
     {
         SpyWinAPI.ShowWindow(h, SW_SHOW);
     }
     else
     {
         SpyWinAPI.ShowWindow(h, SW_HIDE);
     }
 }
Exemplo n.º 6
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == 0)
            {
                SpyWinAPI.ShowWindow(h, SW_SHOWNORMAL);
            }

            if (comboBox1.SelectedIndex == 1)
            {
                SpyWinAPI.ShowWindow(h, SW_SHOWMAXIMIZED);
            }

            if (comboBox1.SelectedIndex == 2)
            {
                SpyWinAPI.ShowWindow(h, SW_SHOWMINIMIZED);
            }
        }
Exemplo n.º 7
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            pos1.Text = string.Format("{0},{1}", Cursor.Position.X, Cursor.Position.Y);


            SpyWinAPI.GetCursorPos(out pt);
            h = SpyWinAPI.WindowFromPoint(pt);
            StringBuilder sb = new StringBuilder(256);

            SpyWinAPI.GetClassName(h, sb, 256);
            wnd_ClassName.Text = sb.ToString();


            SpyWinAPI.GetWindowText(h, sb, 256);
            wnd_Title.Text = sb.ToString();


            wnd_Handle.Text = "0x" + h.ToInt32().ToString("x8").ToUpper();

            SpyWinAPI.GetWindowRect(h, ref rect);
            int width  = rect.Right - rect.Left;
            int height = rect.Bottom - rect.Top;

            wnd_Rect.Text = string.Format("{0},{1}", width, height);

            wnd_Width.Text    = width.ToString();
            wnd_Height.Text   = height.ToString();
            trackBar1.Maximum = width;
            trackBar2.Maximum = height;
            trackBar1.Value   = width;
            trackBar2.Value   = height;


            SpyWinAPI.GetClientRect(h, ref clientRect);
            wnd_ClientRect.Text = string.Format("{0},{1}", clientRect.Right - clientRect.Left, clientRect.Bottom - clientRect.Top);

            button1.Enabled = true;
            button3.Enabled = true;
            button5.Enabled = true;
        }
Exemplo n.º 8
0
 private void button1_Click(object sender, EventArgs e)
 {
     SpyWinAPI.SetWindowText(h, wnd_NewTitle.Text);
 }