GetSystemMetrics

  int GetSystemMetrics(nIndex)    
  int nIndex; /* system measurement to retrieve */

This function retrieves the system metrics. The system metrics are the widths and heights of various display elements of the Windows display. The GetSystemMetrics function can also return flags that indicate whether the current version is a debugging version, whether a mouse is present, or whether the meaning of the left and right mouse buttons have been exchanged.

Parameters

nIndex

Specifies the system measurement to be retrieved. All measurements are given in pixels. The system measurement must be one of the following values:

Index Meaning

SM_CXBORDER Width of window frame that cannot be sized.
SM_CYBORDER Height of window frame that cannot be sized.
SM_CYCAPTION Actual caption height plus SM_CYBORDER.
SM_CXCURSOR Width of cursor.
SM_CYCURSOR Height of cursor.
SM_CXDLGFRAME Width of frame when window has WS_DLGFRAME style.
SM_CYDLGFRAME Height of frame when window has WS_DLGFRAME style.
SM_CXDOUBLECLK Width (in pixels) 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 (in pixels) 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_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 full-screen window.
SM_CYFULLSCREEN Height of window client area for full-screen window (equivalent to the height of the screen minus the height of the window caption).
SM_CXHSCROLL Width of arrow bitmap on horizontal scroll bar.
SM_CYHSCROLL Height of arrow bitmap on horizontal scroll bar.
SM_CXICON Width of icon.
SM_CYICON Height of icon.
SM_CXICONSPACING Width of the rectangles that Program Manager uses to position tiled icons.
SM_CYICONSPACING Height of the rectangles that Program Manager uses to position tiled icons.
SM_CYKANJIWINDOW Height of Kanji window.
SM_CYMENU Height of single-line menu bar minus 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_CXSHADOWDEPTH Specifies the width of the shadow, specified in multiples of SM_CXBORDER.
SM_CYSHADOWDEPTH Specifies the height of the shadow, specified in multiples of SM_CYBORDER.
SM_CXSIZE Width of bitmaps contained in the title bar.
SM_CYSIZE Height of bitmaps contained in the title bar.
SM_CXVSCROLL Width of arrow bitmap on vertical scroll bar.
SM_CYVSCROLL Height of arrow bitmap on vertical scroll bar.
SM_CXHTHUMB Width of thumb box on horizontal scroll bar.
SM_CYVTHUMB Height of thumb box on vertical scroll bar.
SM_DEBUG Nonzero if Windows debugging version.
SM_MENUDROPALIGHMENT Alignment of popup menus. If this value is 0, the left side of a popup menu is aligned with the left side of the corresponding menu-bar item. If this value is nonzero, the left side of a popup menu is aligned with the right side of the corresponding menu-bar item.
SM_MOUSEPRESENT Nonzero if mouse hardware installed.
SM_SWAPBUTTON Nonzero if left and right mouse buttons swapped.

Return Value

The return value specifies the requested system metric.

Comments

System metrics depend on the system display and may vary from display to display.