GetSystemMetrics函数的参数

370 篇文章 6 订阅
259 篇文章 4 订阅


1、
SM_ARRANGE: 用于说明系统如何安排最小化窗口,根据显示器的不同系统数据可能有所不同。其包含一个起始位置和方向。关于在程序中怎么使用我还没有见个这样的代码。

起始位置可为下列值之一:
ARW_BOTTOMLEFT:开始在左下角的屏幕(默认值)。
ARW_BOTTOMRIGHT:开始在右下角的屏幕(相当于ARW_STARTRIGHT)。
ARW_HIDE:在屏幕可见区域隐藏并最小化窗口。
ARW_TOPLEFT:从左上角的屏幕上(相当于ARW_STARTTOP)。
ARW_TOPRIGHT:开始在右上角的屏幕上(相当于ARW_STARTTOP | ARW_STARTRIGHT)。

方向的安排可以为下列值之一:
ARW_DOWN:纵向排列从上到下。
ARW_UP :纵向排列从下到上。
ARW_LEFT :水平排列从左到右。
ARW_RIGHT:水平排列从右到左。

2、
SM_CLEANBOOT返回系统的启动方式。
0:正常启动。
1:安全模式启动。
2:网络安全模式启动。
代码例子:
nBoot = GetSystemMetrics(SM_CLEANBOOT);
switch(nBoot)
{
case 0:
MessageBox(NULL,TEXT("正常启动系统!"),TEXT("提示"),MB_OK);
break;
case 1:
MessageBox(NULL,TEXT("安全模式启动系统!"),TEXT("提示"),MB_OK);
break;
case 2:
MessageBox(NULL,TEXT("网络安全模式启动系统!"),TEXT("提示"),MB_OK);
break;
}

3、
SM_CMOUSEBUTTONS:返回值为系统支持的鼠标键数,返回0则系统中没有安装鼠标。
代码:
nMouseButton = GetSystemMetrics(SM_CMOUSEBUTTONS);
sprintf(szBuffer,"%d",nMouseButton);
MessageBox(NULL,szBuffer,TEXT("系统支持鼠标键数"),MB_OK | MB_ICONINFORMATION);

4、
SM_CXBORDER、SM_CYBORDER:返回以像素值为单位的WINDOWS边框的宽度和高度,如果是3D形态,则等同于SM_CXEDGE。
代码:
int cxBorder = 0;
int cyBorder = 0;

cxBorder = GetSystemMetrics(SM_CXBORDER);
cyBorder = GetSystemMetrics(SM_CYBORDER);

sprintf(szBuffer,"该窗口的边框长:%d、宽:%d",cxBorder,cyBorder);
MessageBox(NULL,szBuffer,TEXT("边框信息"),MB_OK);

5、
SM_CXCURSOR、SM_CYCURSOR:返回以像素为单位的标准光标的宽度和高度。
代码:
int cxCursor = 0;
int cyCursor = 0;

cxCursor = GetSystemMetrics(SM_CXCURSOR);
cyCursor = GetSystemMetrics(SM_CYCURSOR);

sprintf(szBuffer,"系统标准光标的宽度是:%d、高度是:%d",cxCursor,cyCursor);
MessageBox(NULL,szBuffer,TEXT("光标信息"),MB_OK);

6、
SM_CXDLGFRAME、SM_CYDLGFRAME:等同于SM_CXFIXEDFRAME、SM_CYFIXEDFRAME。
SM_CXFIXEDFRAME、SM_CYFIXEDFRAME:围绕具有标题,但不能改变尺寸的窗口(通常是对话框)的边框厚度。
//这里的厚度和上面边框的长度和宽度分别是窗口的那部分呢
//在我的系统上获得的值分别是cxBorder = cyBorder = 1;cxFrame = cyFrame = 3;
//希望知道的高手指点一下

cxFrame = GetSystemMetrics(SM_CXDLGFRAME);
cyFrame = GetSystemMetrics(SM_CYDLGFRAME);

sprintf(szBuffer,"边框的厚度度是:%d、高度是:%d",cxFrame,cyFrame);
MessageBox(NULL,szBuffer,TEXT("边框信息"),MB_OK);

7、
SM_CXDOUBLECLK、SMCYDOUBLECLK:以像素值为单位的双击有效的矩形区域。
代码:
int cxDoubleRect = 0;
int cyDoubleRect = 0;

cxDoubleRect = GetSystemMetrics(SM_CXDOUBLECLK);
cyDoubleRect = GetSystemMetrics(SM_CYDOUBLECLK);

sprintf(szBuffer,"有效区域宽:%d、高:%d",cyDoubleRect,cyDoubleRect);
MessageBox(NULL,szBuffer,TEXT("有效区信息"),MB_OK);
//结果是cxDoubleRect = 4,cyDoubleRect = 4;

8、
SM_CXFRAME、SM_CYFRAME:等同于SM_CXSIZEFRAME、SM_CYSIZEFRAME
SM_CXSIZEFRAME、SM_CYSIZEFRAME:围绕可改变大小的窗口边框的厚度。

9、
SM_CXFULLSCREEN、SM_CYFULLSCREEN:全屏幕窗口的窗口区域的宽度和高度。

10、
SM_CXHSCROLL、SM_CYHSCROLL:水平滚动条的宽度和水平滚动条上箭头的高度。
代码:

int cxHscroll = 0;
int cyHscroll = 0;

cxHscroll = GetSystemMetrics(SM_CXHSCROLL);
cyHscroll = GetSystemMetrics(SM_CYHSCROLL);

sprintf(szBuffer,"水平滚动条高度:%d、箭头高度:%d",cxHscroll,cyHscroll);
MessageBox(NULL,szBuffer,TEXT("TIP"),MB_OK);

11、
SM_CXHTHUMB:水平滚动条上滑块的宽度

12、
SM_CXICON、SM_CYICON:系统缺省的图标的宽度和高度(一般是32×32)。

13、
SM_CXICONSPACING、SM_CYICONSPACING:以大图标方式查看item时图标之间的距离,这个距离总是大于SM_CXICON和SM_CYICON。

14、
SM_CXMAXIMIZED、SM_CYMAXIMIZED:处于顶层的最大化窗口的缺省尺寸。

15、
SM_CXMAXTRACK、SM_CYMAXTRACK:具有可改变尺寸边框和标题栏窗口的缺省尺寸,如果窗口尺寸大于这个尺寸,窗口是不可移动的。

16、
SM_CXMENUCHECK、SM_CYMENUCHECK:以像素为单位计算菜单选中标记位图的尺寸。

17.、
SM_CXMENUSIZE、SM_CYMENUSIZE:以像素为单位计算菜单栏按钮的尺寸。

18、
SM_CXMIN、SM_CYMIN:窗口所能达到的最小尺寸。

19、
SM_CXMINIMIZED、SM_CYMINIMIZED、正常的最小化窗口的尺寸。

20、
SM_CXMINTRACK、SM_CYMINTRACK:最小跟踪距离,当拖动窗口距离小于这个值时,窗口不会移动。

21、
SM_CXSCREEN、SM_CYSCREEN:以像素为单位计算屏幕尺寸

22、
SM_CXSIZE、SM_CYSIZE:以像素为单位计算标题栏按钮的尺寸。

23、
SM_CXSMICON、SM_CYSMICON:以像素计算的小图标的尺寸,小图标一般出现在标题栏上

24、
SM_CXVSCROLL,
SM_CYVSCROLL 以像素计算的垂直滚动条的宽度和垂直滚动条上箭头的高度

25、
SM_CYCAPTION 以像素计算的普通窗口标题的高度

26、
SM_CYMENU 以像素计算的单个菜单条的高度

27、
SM_CYSMCAPTION 以像素计算的窗口小标题栏的高度

28、
SM_CYVTHUMB 以像素计算的垂直滚动条中滚动块的高度

29、
SM_DBCSENABLED 如果为TRUE或不为0的值表明系统安装了双字节版本的USER.EXE,为FALSE或0则不是。

30、
SM_DEBUG 如果为TRUE或不为0的值表明系统安装了debug版本的USER.EXE,为FALSE或0则不是。

31、
SM_MENUDROPALIGNMENT 如果为TRUE或不为0的值下拉菜单是右对齐的否则是左对齐的。

32、
SM_MOUSEPRESENT 如果为TRUE或不为0的值则安装了鼠标,否则没有安装。

33、
SM_MOUSEWHEELPRESENT 如果为TRUE或不为0的值则安装了滚轮鼠标,否则没有安装。(Windows NT only)。

34、
SM_SWAPBUTTON 如果为TRUE或不为0的值则鼠标左右键交换,否则没有。


index值  SM_CXSCREEN = 0 'X Size of screen

  SM_CYSCREEN = 1 'Y Size of Screen

  SM_CXVSCROLL = 2 'X Size of arrow in vertical scroll bar.

  SM_CYHSCROLL = 3 'Y Size of arrow in horizontal scroll bar

  SM_CYCAPTION = 4 'Height of windows caption

  SM_CXBORDER = 5 'Width of no-sizable borders

  SM_CYBORDER = 6 'Height of non-sizable borders

  SM_CXDLGFRAME = 7 'Width of dialog box borders

  SM_CYDLGFRAME = 8 'Height of dialog box borders

  SM_CYHTHUMB = 9 'Height of scroll box on horizontal scroll bar

  SM_CXHTHUMB = 10 ' Width of scroll box on horizontal scroll bar

  SM_CXICON = 11 'Width of standard icon

  SM_CYICON = 12 'Height of standard icon

  SM_CXCURSOR = 13 'Width of standard cursor

  SM_CYCURSOR = 14 'Height of standard cursor

  SM_CYMENU = 15 'Height of menu

  SM_CXFULLSCREEN = 16 'Width of client area of maximized window

  SM_CYFULLSCREEN = 17 'Height of client area of maximized window

  SM_CYKANJIWINDOW = 18 'Height of Kanji window

  SM_MOUSEPRESENT = 19 'True is a mouse is present

  SM_CYVSCROLL = 20 'Height of arrow in vertical scroll bar

  SM_CXHSCROLL = 21 'Width of arrow in vertical scroll bar

  SM_DEBUG = 22 'True if deugging version of windows is running

  SM_SWAPBUTTON = 23 'True if left and right buttons are swapped.

  SM_CXMIN = 28 'Minimum width of window

  SM_CYMIN = 29 'Minimum height of window

  SM_CXSIZE = 30 'Width of title bar bitmaps

  SM_CYSIZE = 31 'height of title bar bitmaps

  SM_CXMINTRACK = 34 'Minimum tracking width of window

  SM_CYMINTRACK = 35 'Minimum tracking height of window

  SM_CXDOUBLECLK = 36 'double click width

  SM_CYDOUBLECLK = 37 'double click height

  SM_CXICONSPACING = 38 'width between desktop icons

  SM_CYICONSPACING = 39 'height between desktop icons

  SM_MENUDROPALIGNMENT = 40 'Zero if popup menus are aligned to the left of the memu bar item. True if it is aligned to the right.

  SM_PENWINDOWS = 41 'The handle of the pen windows DLL if loaded.

  SM_DBCSENABLED = 42 'True if double byte characteds are enabled

  SM_CMOUSEBUTTONS = 43 'Number of mouse buttons.

  SM_CMETRICS = 44 'Number of system metrics

  SM_CLEANBOOT = 67 'Windows 95 boot mode. 0 = normal, 1 = safe, 2 = safe with network

  SM_CXMAXIMIZED = 61 'default width of win95 maximised window

  SM_CXMAXTRACK = 59 'maximum width when resizing win95 windows

  SM_CXMENUCHECK = 71 'width of menu checkmark bitmap

  SM_CXMENUSIZE = 54 'width of button on menu bar

  SM_CXMINIMIZED = 57 'width of rectangle into which minimised windows must fit.

  SM_CYMAXIMIZED = 62 'default height of win95 maximised window

  SM_CYMAXTRACK = 60 'maximum width when resizing win95 windows

  SM_CYMENUCHECK = 72 'height of menu checkmark bitmap

  SM_CYMENUSIZE = 55 'height of button on menu bar

  SM_CYMINIMIZED = 58 'height of rectangle into which minimised windows must fit.

  SM_CYSMCAPTION = 51 'height of windows 95 small caption

  SM_MIDEASTENABLED = 74 'Hebrw and Arabic enabled for windows 95

  SM_NETWORK = 63 'bit o is set if a network is present.

  SM_SECURE = 44 'True if security is present on windows 95 system

  SM_SLOWMACHINE = 73 'true if machine is too slow to run win95.

 

index值  SM_CXSCREEN = 0 'X Size of screen

  SM_CYSCREEN = 1 'Y Size of Screen

  SM_CXVSCROLL = 2 'X Size of arrow in vertical scroll bar.

  SM_CYHSCROLL = 3 'Y Size of arrow in horizontal scroll bar

  SM_CYCAPTION = 4 'Height of windows caption

  SM_CXBORDER = 5 'Width of no-sizable borders

  SM_CYBORDER = 6 'Height of non-sizable borders

  SM_CXDLGFRAME = 7 'Width of dialog box borders

  SM_CYDLGFRAME = 8 'Height of dialog box borders

  SM_CYHTHUMB = 9 'Height of scroll box on horizontal scroll bar

  SM_CXHTHUMB = 10 ' Width of scroll box on horizontal scroll bar

  SM_CXICON = 11 'Width of standard icon

  SM_CYICON = 12 'Height of standard icon

  SM_CXCURSOR = 13 'Width of standard cursor

  SM_CYCURSOR = 14 'Height of standard cursor

  SM_CYMENU = 15 'Height of menu

  SM_CXFULLSCREEN = 16 'Width of client area of maximized window

  SM_CYFULLSCREEN = 17 'Height of client area of maximized window

  SM_CYKANJIWINDOW = 18 'Height of Kanji window

  SM_MOUSEPRESENT = 19 'True is a mouse is present

  SM_CYVSCROLL = 20 'Height of arrow in vertical scroll bar

  SM_CXHSCROLL = 21 'Width of arrow in vertical scroll bar

  SM_DEBUG = 22 'True if deugging version of windows is running

  SM_SWAPBUTTON = 23 'True if left and right buttons are swapped.

  SM_CXMIN = 28 'Minimum width of window

  SM_CYMIN = 29 'Minimum height of window

  SM_CXSIZE = 30 'Width of title bar bitmaps

  SM_CYSIZE = 31 'height of title bar bitmaps

  SM_CXMINTRACK = 34 'Minimum tracking width of window

  SM_CYMINTRACK = 35 'Minimum tracking height of window

  SM_CXDOUBLECLK = 36 'double click width

  SM_CYDOUBLECLK = 37 'double click height

  SM_CXICONSPACING = 38 'width between desktop icons

  SM_CYICONSPACING = 39 'height between desktop icons

  SM_MENUDROPALIGNMENT = 40 'Zero if popup menus are aligned to the left of the memu bar item. True if it is aligned to the right.

  SM_PENWINDOWS = 41 'The handle of the pen windows DLL if loaded.

  SM_DBCSENABLED = 42 'True if double byte characteds are enabled

  SM_CMOUSEBUTTONS = 43 'Number of mouse buttons.

  SM_CMETRICS = 44 'Number of system metrics

  SM_CLEANBOOT = 67 'Windows 95 boot mode. 0 = normal, 1 = safe, 2 = safe with network

  SM_CXMAXIMIZED = 61 'default width of win95 maximised window

  SM_CXMAXTRACK = 59 'maximum width when resizing win95 windows

  SM_CXMENUCHECK = 71 'width of menu checkmark bitmap

  SM_CXMENUSIZE = 54 'width of button on menu bar

  SM_CXMINIMIZED = 57 'width of rectangle into which minimised windows must fit.

  SM_CYMAXIMIZED = 62 'default height of win95 maximised window

  SM_CYMAXTRACK = 60 'maximum width when resizing win95 windows

  SM_CYMENUCHECK = 72 'height of menu checkmark bitmap

  SM_CYMENUSIZE = 55 'height of button on menu bar

  SM_CYMINIMIZED = 58 'height of rectangle into which minimised windows must fit.

  SM_CYSMCAPTION = 51 'height of windows 95 small caption

  SM_MIDEASTENABLED = 74 'Hebrw and Arabic enabled for windows 95

  SM_NETWORK = 63 'bit o is set if a network is present.

  SM_SECURE = 44 'True if security is present on windows 95 system

  SM_SLOWMACHINE = 73 'true if machine is too slow to run win95.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值