The GetSystemMetrics function retrieves various system metrics (widths and heights of display elements) and system configuration settings. Alldimensions retrieved byGetSystemMetrics are inpixels.
GetSystemMetrics函数检索系统各种的指标(显示元素的宽度和高度)以及系统配置设置。所有被GetSystemMetrics 检索出尺寸都是以像素为单位的。
int GetSystemMetrics(
int nIndex // system metric or configuration setting(系统指标或者配置设置)
);
Paramenters:
nIndex:
[in] Specifies the system metric or configuration setting to retrieve. All SM_CX* values are widths. All SM_CY* values are heights. The following values are defined.
参数:
nIndex:
[in] 区分检索的系统指标或者配置设置。所有以SM_CX开头的值是指宽度。所有以SM_CY开头的值是指告诉。 下面是被定义的值。
Value | Meaning |
---|---|
SM_ARRANGE 返回是否预备最小化. | Flags specifying how the system arranged minimized windows. For more information about minimized windows, see the following Remarks section. 具体说明系统如何安排窗口最小化的标志。为了获得最小化窗口的更多信息,请参阅下面的备注部分。 |
SM_CLEANBOOT 返回值说明系统的启动方式: 0 正常启动; 1 .安全模式启动; 2 网络安全模式启动 | Value that specifies how the system was started: 0 Normal boot Fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user's startup files. 自动防故障装置启动(也被称为SafeBoot,Safe Mode 或者Clean Boot)绕过用户的启动文件。 |
SM_CMONITORS | Windows 98/Me, Windows 2000/XP: Number of display monitors on the desktop. See Remarks for more information. 返回桌面的显示监视器的数量。更多信息参见备注。 |
SM_CMOUSEBUTTONS 返回值为系统支持的鼠标键数,返回0,则系统中没有安装鼠标 | Number of buttons on mouse, or zero if no mouse is installed. 返回鼠标按键的数量,若鼠标未安装则返回0. |
SM_CXBORDER, 返回以相素值为单位的Windows窗口边框的宽度和高度 | Width and height, in pixels, of a window border. This is equivalent to the SM_CXEDGE value for windows with the 3-D look. 返回以相素值为单位的Windows窗口边框的宽度和高度。如果Windows的为3D形态,则等同于SM_CXEDGE参数。 |
SM_CXCURSOR, SM_CYCURSOR 返回以相素值为单位的标准光标的宽度和高度 | Width and height, in pixels, of a cursor. The system cannot create cursors of other sizes. 返回以像素值为单位的光标的宽度和高度。系统不能创造的其他光标的尺寸。 |
SM_CXDLGFRAME, SM_CYDLGFRAME | Same as SM_CXFIXEDFRAME and SM_CYFIXEDFRAME. 和SM_CXFIXEDFRAME, SM_CYFIXEDFRAME一样 |
SM_CXDOUBLECLK, 返回以相素值为单位的双击有效的矩形区域 | Width and height, in pixels, of the rectangle around the location of a first click in a double-click sequence. The second click must occur within this rectangle for the system to consider the two clicks a double-click. (The two clicks must also occur within a specified time.) To set the width and height of the double-click rectangle, call SystemParametersInfo with the SPI_SETDOUBLECLKHEIGHT and SPI_SETDOUBLECLKWIDTH flags. //?????????? |
SM_CXDRAG, SM_CYDRAG | Width and height, in pixels, of a rectangle centered on a drag point to allow for limited movement of the mouse pointer before a drag operation begins. This allows the user to click and release the mouse button easily without unintentionally starting a drag operation. //返回在拖动之前,以像素为单位,以允许有限的运动鼠标拖动的的一个点为中心的矩形的宽和高。这需要用户在有意的拖动时可以容易地去单击和释放鼠标。 |
SM_CXEDGE, 返回以相素值为单位的3D边框的宽度和高度 | Dimensions, in pixels, of a 3-D border. These are the 3-D counterparts of SM_CXBORDER and SM_CYBORDER. //返回以像素为单位的3D边界的高度和宽度。和SM_CXBORDER、SM_CYBORDER是一样的。 |
SM_CXFIXEDFRAME, 返回围绕具有标题但无法改变尺寸的窗口(通常是一些对话框)的边框的厚度 | Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable. SM_CXFIXEDFRAME is the height of the horizontal border and SM_CYFIXEDFRAME is the width of the vertical border. Same as SM_CXDLGFRAME and SM_CYDLGFRAME. //???????????? |
SM_CXFOCUSBORDER, SM_CYFOCUSBORDER | Windows XP: The width of the left and right edges and the height of the top and bottom edges of the focus rectangle drawn byDrawFocusRect. These values are in pixels. |
SM_CXFRAME, SM_CYFRAME | Same as SM_CXSIZEFRAME and SM_CYSIZEFRAME. |
SM_CXFULLSCREEN, 返回全屏幕窗口的窗口区域的宽度和高度 | Width and height of the client area for a full-screen window on the primary display monitor. To get the coordinates of theportion of the screen not obscured by the system taskbar or by application desktop toolbars, call theSystemParametersInfo function with the SPI_GETWORKAREA value. 主显示屏上全屏的客户区域的宽度和高度。为了获得不被系统工具条或者应用程序桌面工具条掩盖的部分屏幕的坐标,调用SPI_GETWORKAREA的值调用SystemParametersInfo函数。 |
SM_CXHSCROLL, SM_CYHSCROLL | Width, in pixels, of the arrow bitmap on a horizontal scroll bar; and height, in pixels, of a horizontal scroll bar. |
SM_CXHTHUMB | Width, in pixels, of the thumb box in a horizontal scroll bar. |
SM_CXICON, SM_CYICON | The default width and height, in pixels, of an icon. The LoadIcon function can load only icons of these dimensions. |
SM_CXICONSPACING, SM_CYICONSPACING | Dimensions, in pixels, of a grid cell for items in large icon view. Each item fits into a rectangle of this size when arranged. These values are always greater than or equal to SM_CXICON and SM_CYICON. |
SM_CXMAXIMIZED, SM_CYMAXIMIZED | Default dimensions, in pixels, of a maximized top-level window on the primary display monitor. |
SM_CXMAXTRACK, SM_CYMAXTRACK | Default maximum dimensions, in pixels, of a window that has a caption and sizing borders. This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions. A window can override these values by processing the WM_GETMINMAXINFO message. |
SM_CXMENUCHECK, SM_CYMENUCHECK | Dimensions, in pixels, of the default menu check-mark bitmap. |
SM_CXMENUSIZE, SM_CYMENUSIZE | Dimensions, in pixels, of menu bar buttons, such as the child window close button used in the multiple document interface. |
SM_CXMIN, SM_CYMIN | Minimum width and height, in pixels, of a window. |
SM_CXMINIMIZED, SM_CYMINIMIZED | Dimensions, in pixels, of a normal minimized window. |
SM_CXMINSPACING SM_CYMINSPACING | Dimensions, in pixels, of a grid cell for minimized windows. Each minimized window fits into a rectangle this size when arranged. These values are always greater than or equal to SM_CXMINIMIZED and SM_CYMINIMIZED. |
SM_CXMINTRACK, SM_CYMINTRACK | Minimum tracking width and height, in pixels, of a window. The user cannot drag the window frame to a size smaller than these dimensions. A window can override these values by processing theWM_GETMINMAXINFO message. |
SM_CXSCREEN, SM_CYSCREEN | Width and height, in pixels, of the screen of the primary display monitor. These are the same values you obtain by callingGetDeviceCaps(hdcPrimaryMonitor, HORZRES/VERTRES). |
SM_CXSIZE, SM_CYSIZE | Width and height, in pixels, of a button in a window's caption or title bar. |
SM_CXSIZEFRAME, SM_CYSIZEFRAME | Thickness, in pixels, of the sizing border around the perimeter of a window that can be resized. SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border. Same as SM_CXFRAME and SM_CYFRAME. |
SM_CXSMICON, SM_CYSMICON | Recommended dimensions, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view. |
SM_CXSMSIZE SM_CYSMSIZE | Dimensions, in pixels, of small caption buttons. |
SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN | Windows 98/Me, Windows 2000/XP: Width and height, in pixels, of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN metrics are the coordinates of the top-left corner of the virtual screen. |
SM_CXVSCROLL, SM_CYVSCROLL | Width, in pixels, of a vertical scroll bar; and height, in pixels, of the arrow bitmap on a vertical scroll bar. |
SM_CYCAPTION | Height, in pixels, of a normal caption area. |
SM_CYKANJIWINDOW | For double byte character set versions of the system, this is the height, in pixels, of the Kanji window at the bottom of the screen. |
SM_CYMENU | Height, in pixels, of a single-line menu bar. |
SM_CYSMCAPTION | Height, in pixels, of a small caption. |
SM_CYVTHUMB | Height, in pixels, of the thumb box in a vertical scroll bar. |
SM_DBCSENABLED | TRUE or nonzero if the double-byte character-set (DBCS) version of User.exe is installed; FALSE or zero otherwise. |
SM_DEBUG | TRUE or nonzero if the debugging version of User.exe is installed; FALSE or zero otherwise. |
SM_IMMENABLED | Windows 2000/XP: TRUE or nonzero if Input Method Manager/Input Method Editor features are enabled; FALSE or zero otherwise. SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application. To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page. Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts or registry setting may not be present. |
SM_MENUDROPALIGNMENT | TRUE or nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; FALSE or zero if the menus are left-aligned. |
SM_MIDEASTENABLED | TRUE if the system is enabled for Hebrew and Arabic languages. |
SM_MOUSEPRESENT | TRUE or nonzero if a mouse is installed; FALSE or zero otherwise. |
SM_MOUSEWHEELPRESENT | Windows NT 4.0 and later, Windows 98/Me: TRUE or nonzero if a mouse with a wheel is installed; FALSE or zero otherwise. |
SM_NETWORK | The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use. |
SM_PENWINDOWS | TRUE or nonzero if the Microsoft Windows for Pen computing extensions are installed; FALSE or zero otherwise. |
SM_REMOTESESSION | Windows NT 4.0 SP4 and later: This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services client session, the return value is TRUE or nonzero. If the calling process is associated with the Terminal Server console session, the return value is zero. |
SM_SECURE | TRUE if security is present; FALSE otherwise. |
SM_SAMEDISPLAYFORMAT | Windows 98/Me, Windows 2000/XP: TRUE if all the display monitors have the same color format, FALSE otherwise. Note that two displays can have the same bit depth, but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits, or those bits can be located in different places in a pixel's color value. |
SM_SHOWSOUNDS | TRUE or nonzero if the user requires an application to present information visually in situations where it would otherwise present the information only in audible form; FALSE, or zero, otherwise. |
SM_SHUTTINGDOWN | Windows XP: TRUE if the current session is shutting down; FALSE otherwise. |
SM_SLOWMACHINE | TRUE if the computer has a low-end (slow) processor; FALSE otherwise. |
SM_SWAPBUTTON | TRUE or nonzero if the meanings of the left and right mouse buttons are swapped; FALSE or zero otherwise. |
SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN | Windows 98/Me, Windows 2000/XP: Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. The SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN metrics are the width and height of the virtual screen. |