取任务栏的句柄及相关信息(仅以取任务栏的高度为例)
来源:互联网 发布:有域名没有空间 编辑:程序博客网 时间:2024/06/06 22:02
//怎么得到任务栏的高度?
//仅供参考,不见得是最佳方法
//注意任务栏有可能在边上
// http://ike.126.com
[DllImport("User32.dll",EntryPoint="FindWindow")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
[DllImport("user32.dll",EntryPoint="GetWindowRect")]
private static extern bool GetWindowRect( IntPtr hWnd, ref RECT lpRect );
private void button1_Click(object sender, System.EventArgs e)
{
IntPtr hWnd = FindWindow ("Shell_TrayWnd",null);
RECT rc = new RECT();
try
{
GetWindowRect(hWnd,ref rc);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
}
Console.WriteLine("Height:{0}",rc.Bottom-rc.Top);
}
////////////////
另外一种方法
Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
屏幕高
Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
工作区高
相减 应该是任务栏高吧
////////////////
//如此
int a = Screen.PrimaryScreen.WorkingArea.Height;
int b = Screen.PrimaryScreen.Bounds.Height;
Console.WriteLine("{0}",b-a);
/////
- 取任务栏的句柄及相关信息(仅以取任务栏的高度为例)
- java取任务栏高度的方法汇集
- java取任务栏高度
- 取任务栏的窗体列表
- 得到任务栏的高度
- 取得任务栏的高度
- 判断任务栏的位置高度
- VC 获取任务栏窗口的句柄
- 任务栏提示信息的刷新
- 任务栏句柄
- 如何获取任务栏与菜单栏的高度?
- 缩减Windows 7任务栏的高度
- VC++得到任务栏的高度和位置
- VC取得任务栏高度的方法
- 取BOM的相关信息报表。
- WIN API-VFP取得任务栏的尺寸(宽度和高度)及位置
- VC++得到任务栏的高度和位置的方法
- Delphi中三种方法获取Windows任务栏的高度
- 各种TCP端口详细说明中文版
- Linux配置web服务器全攻略
- 精妙的SQL语句
- SQLServer和Oracle常用函数对比
- Web开放趋势代表:无所不在的Google API
- 取任务栏的句柄及相关信息(仅以取任务栏的高度为例)
- 如何用sql命令,去启动合并复制的同步代理
- NET中各种数据库连接大全
- asdfsddddddddddddddd
- VB2005语言新功能
- Oracle函数列表速查
- 利用PHP实现通过千千静听的歌曲列表进行歌曲导入
- 面视题目
- 美好生活四节拍