int GetSystemMetrics(nIndex) | |||||
int nIndex; | /* system measurement to retrieve | */ |
The GetSystemMetrics function retrieves the system metrics. The system metrics are the widths and heights of the various elements displayed by Windows. GetSystemMetrics can also return flags that indicate whether the current version of the Windows operating system is a debugging version, whether a mouse is present, or whether the meanings of the left and right mouse buttons have been exchanged.
nIndex
Specifies the system measurement to be retrieved. All measurements are given in pixels. The system measurement must be one of the following values:
Value | Meaning |
SM_CXBORDER | Width of window frame that cannot be sized. |
SM_CYBORDER | Height of window frame that cannot be sized. |
SM_CYCAPTION | Height of window title. This is the title height plus the height of the window frame that cannot be sized (SM_CYBORDER). |
SM_CXCURSOR | Width of cursor. |
SM_CYCURSOR | Height of cursor. |
SM_CXDOUBLECLK | Width of the rectangle around the location of the 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. |
SM_CYDOUBLECLK | Height of the rectangle around the location of the 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. |
SM_CXDLGFRAME | Width of frame when window has the WS_DLGFRAME style. |
SM_CYDLGFRAME | Height of frame when window has the WS_DLGFRAME style. |
SM_CXFRAME | Width of window frame that can be sized. |
SM_CYFRAME | Height of window frame that can be sized. |
SM_CXFULLSCREEN | Width of window client area for a full-screen window. |
SM_CYFULLSCREEN | Height of window client area for a full-screen window (equivalent to the height of the screen minus the height of the window title). |
SM_CXICON | Width of icon. |
SM_CYICON | Height of icon. |
SM_CXICONSPACING | Width of rectangles the system uses to position tiled icons. |
SM_CYICONSPACING | Height of rectangles the system uses to position tiled icons. |
SM_CYKANJIWINDOW | Height of Kanji window. |
SM_CYMENU | Height of single-line menu bar. This is the menu height minus the height of the window frame that cannot be sized (SM_CYBORDER). |
SM_CXMIN | Minimum width of window. |
SM_CYMIN | Minimum height of window. |
SM_CXMINTRACK | Minimum tracking width of window. |
SM_CYMINTRACK | Minimum tracking height of window. |
SM_CXSCREEN | Width of screen. |
SM_CYSCREEN | Height of screen. |
SM_CXHSCROLL | Width of arrow bitmap on a horizontal scroll bar. |
SM_CYHSCROLL | Height of arrow bitmap on a horizontal scroll bar. |
SM_CXVSCROLL | Width of arrow bitmap on a vertical scroll bar. |
SM_CYVSCROLL | Height of arrow bitmap on a vertical scroll bar. |
SM_CXSIZE | Width of bitmaps contained in the title bar. |
SM_CYSIZE | Height of bitmaps contained in the title bar. |
SM_CXHTHUMB | Width of scroll box (thumb) on horizontal scroll bar. |
SM_CYVTHUMB | Height of scroll box on vertical scroll bar. |
SM_DBCSENABLED | Nonzero if current version of Windows uses double-byte characters; otherwise, this value returns zero. |
SM_DEBUG | Nonzero if the Windows version is a debugging version. |
SM_MENUDROPALIGNMENT | Alignment of pop-up menus. If this value is zero, the left side of a pop-up menu is aligned with the left side of the corresponding menu-bar item. If this value is nonzero, the left side of a pop-up menu is aligned with the right side of the corresponding menu-bar item. |
SM_MOUSEPRESENT | Nonzero if the mouse hardware is installed. |
SM_PENWINDOWS | Handle of the Pen Windows dynamic-link library (DLL) if Pen Windows is installed. |
SM_SWAPBUTTON | Nonzero if the left and right mouse buttons are swapped. |
The return value specifies the requested system metric if the function is successful.
System metrics depend on the type of screen and may vary from screen to screen.