zoukankan      html  css  js  c++  java
  • 获取任务栏大小

    实现效果;

      

    知识运用:

    API  FindWindow函数  //可用来返回任务栏所在窗口Shell_TrayWnd的句柄

       IpClassName :要返回的窗口的类名称字符串指针

      IpWindowName:要返回的窗口的名称

      GetWindowRect函数  //获取任何一个窗口的矩阵范围的函数

      hwnd:目标窗口的句柄

      IpRect:存储窗口区域的Rectangle结构变量

      

    实现代码:

            [DllImport("user32.dll")]
            public static extern int FindWindow(string IpClassName,string IpWindowName);
            [DllImport("user32.dll")]
            public static extern int GetWindowRect(int hwnd,ref Rectangle IpRect);
            Rectangle rect;
            private void button1_Click(object sender, EventArgs e)
            {
                if ((GetWindowRect(FindWindow("Shell_TrayWnd", null), ref rect)) == 0)
                    return;
                else
                {
                    textBox1.Text = Convert.ToString(rect.Left);
                    textBox2.Text = Convert.ToString(rect.Top);
                    textBox3.Text = Convert.ToString(rect.Right);
                    textBox4.Text = Convert.ToString(rect.Bottom);
                }
            }
    
  • 相关阅读:
    数据库函数
    数据库查询习题整理(二)
    数据库查询习题整理(一)
    1202数据库查询
    1201新课程TSQL语句
    1123项目第五天
    1121项目第四天
    1120项目第三天
    14
    にちかん
  • 原文地址:https://www.cnblogs.com/feiyucha/p/10293275.html
Copyright © 2011-2022 走看看