获取系统任务栏位置宽高信息的方法
2014-06-12 11:34
323 查看
获取系统任务栏位置宽高信息的方法
void GetTaskbarInfo(int &width, int &height, int &pos)
{//获取系统任务栏状态位置有四种情况:左、上、右、下,此外要考虑任务栏自动隐藏的情况
int wx = GetSystemMetrics(SM_CXSCREEN);
int wy = GetSystemMetrics(SM_CYSCREEN);
CRect rtWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rtWorkArea, 0);
//1.任务栏停靠在左边情况
if (0!=rtWorkArea.left)
{
width = wx - rtWorkArea.Width();
height = wy;
pos = 0;
return;
}
//2.任务栏停靠在上边情况
if(0!=rtWorkArea.top)
{
width = wx;
height = wy - rtWorkArea.Height();
pos = 1;
return;
}
//3.任务栏停靠在右边情况
if(0==rtWorkArea.left && wx!=rtWorkArea.Width())
{
width = wx - rtWorkArea.Width();
height = wy;
pos = 2;
return;
}
//4.任务栏停靠在下边情况
if(0==rtWorkArea.top && wy!=rtWorkArea.Height())
{
width = wx;
height = wy - rtWorkArea.Height();
pos = 3;
return;
}
//5.任务栏自动隐藏的情况,这样其宽高都是0
if(0==rtWorkArea.left && 0==rtWorkArea.top
&& wx==rtWorkArea.Width() && wy==rtWorkArea.Height())
{
width = 0;
height =0;
pos = 4;
return;
}
}
void GetTaskbarInfo(int &width, int &height, int &pos)
{//获取系统任务栏状态位置有四种情况:左、上、右、下,此外要考虑任务栏自动隐藏的情况
int wx = GetSystemMetrics(SM_CXSCREEN);
int wy = GetSystemMetrics(SM_CYSCREEN);
CRect rtWorkArea;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rtWorkArea, 0);
//1.任务栏停靠在左边情况
if (0!=rtWorkArea.left)
{
width = wx - rtWorkArea.Width();
height = wy;
pos = 0;
return;
}
//2.任务栏停靠在上边情况
if(0!=rtWorkArea.top)
{
width = wx;
height = wy - rtWorkArea.Height();
pos = 1;
return;
}
//3.任务栏停靠在右边情况
if(0==rtWorkArea.left && wx!=rtWorkArea.Width())
{
width = wx - rtWorkArea.Width();
height = wy;
pos = 2;
return;
}
//4.任务栏停靠在下边情况
if(0==rtWorkArea.top && wy!=rtWorkArea.Height())
{
width = wx;
height = wy - rtWorkArea.Height();
pos = 3;
return;
}
//5.任务栏自动隐藏的情况,这样其宽高都是0
if(0==rtWorkArea.left && 0==rtWorkArea.top
&& wx==rtWorkArea.Width() && wy==rtWorkArea.Height())
{
width = 0;
height =0;
pos = 4;
return;
}
}
相关文章推荐
- 通过读proc等方式获取Linux系统状态信息的一些方法
- 整理及中常用的获取位置信息的方法
- C++获取Windows系统License信息的方法
- Java获取系统信息(cpu,内存,硬盘,进程等)的相关方法
- 解析php中获取系统信息的方法
- c#获取xp系统信息的几种方法
- 获取系统相关信息的方法
- Java获取系统信息(cpu,内存,硬盘,进程等)的相关方法
- 如何获取系统任务栏位置
- 用QextSerialPort库,获取系统当前可用串口信息的方法
- 获取程序在任务栏中按钮的位置的方法
- Java获取系统信息(cpu,内存,硬盘,进程等)的相关方法 .
- .NET插件系统之二——不实例化获取插件信息和可视化方法
- php中获取系统信息的方法
- php中获取系统信息的方法
- Java获取系统信息(cpu,内存,硬盘,进程等)的相关方法
- 什么是DMI,SMBIOS,符合SMBIOS规范的计算机的系统信息获取方法
- Java获取系统信息(cpu,内存,硬盘,进程等)的相关方法
- 解析Android获取系统cpu信息,内存,版本,电量等信息的方法详解
- 获取erlang系统信息的一些方法