Microsoft Windows CE 3.0  

GetSystemMetrics

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function retrieves the dimensions—widths and heights—of Windows display elements and system configuration settings. All dimensions retrieved by GetSystemMetricsare in pixels. The RAPI version is CeGetSystemMetricsfor versions 2.0 and later.

int
GetSystemMetrics(
int
nIndex
);

Parameters

nIndex
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.
Value Description
SM_ARRANGE Flags specifying how the system arranged minimized windows. For more information about minimized windows, see the following Remarks section.
SM_CLEANBOOT Value that specifies how the system was started, as shown in the following table.
  0 Normal boot
  1 Fail-safe boot
  2 Fail-safe with network boot
  Fail-safe boot (also called SafeBoot) bypasses the user's startup files.
SM_CMONITORS Number of display monitors on the Windows CE-based device. Supported in Windows CE versions 4.0 and later.
SM_CMOUSEBUTTONS Number of buttons on mouse, or zero if no mouse is installed.
SM_CXBORDER, SM_CYBORDER Width and height, in pixels, of a window border. This is equivalent to the SM_CXEDGE value for windows with the 3-D look.
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_CXDOUBLECLK, SM_CYDOUBLECLK 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.)
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, SM_CYEDGE Dimensions, in pixels, of a 3-D border. These are the 3-D counterparts of SM_CXBORDER and SM_CYBORDER.
SM_CXFIXEDFRAME, SM_CYFIXEDFRAME Thickness, in pixels, of the frame around the perimeter of a window that has a caption but is not sizable. SM_CXFIXEDFRAME is the width of the horizontal border and SM_CYFIXEDFRAME is the height of the vertical border.

Same as SM_CXDLGFRAME and SM_CYDLGFRAME.

SM_CXFRAME, SM_CYFRAME Same as SM_CXSIZEFRAME and SM_CYSIZEFRAME.
SM_CXFULLSCREEN, SM_CYFULLSCREEN Width and height of the client area for a full-screen window on the primary display monitor. To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfofunction with the SPI_GETWORKAREA value.
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 LoadIconfunction 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.
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.
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 calling GetDeviceCaps( 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 Width and height, in pixels, of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. Supported in Windows CE versions 4.0 and later.
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_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 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_SECURE TRUE if security is present; FALSE otherwise.
SM_SAMEDISPLAYFORMAT TRUE if all the display monitors have the same color format, FALSE otherwise. Supported in Windows CE versions 4.0 and later.
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_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 Coordinates for the left side and the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors. Supported in Windows CE versions 4.0 and later.

Return Values

The requested system metric or configuration setting indicates success. Zero indicates failure. The GetLastErrorfunction does not provide extended error information.

Windows CE Remarks

Windows CE does not support the following nIndexvalues:

SM_ARRANGE SM_CXMINIMIZED
SM_CLEANBOOT SM_CYMINIMIZED
SM_CMETRICS SM_CXMINSPACING
SM_CMOUSEBUTTONS SM_CYMINSPACING
SM_CXCURSOR SM_CXMINTRACK
SM_CYCURSOR SM_CYMINTRACK
SM_CXDRAG SM_CXSIZE
SM_CYDRAG SM_CYSIZE
SM_CXFRAME SM_CXSIZEFRAME
SM_CYFRAME SM_CYSIZEFRAME
SM_CXFULLSCREEN SM_CXSMSIZE
SM_CYFULLSCREEN SM_CYSMSIZE
SM_CXHTHUMB SM_CYSMCAPTION
SM_CYKANJIWINDOW SM_CYVTHUMB
SM_CXMAXIMIZED SM_DBCSENABLED
SM_CYMAXIMIZED SM_MENUDROPALIGNMENT
SM_CXMAXTRACK SM_MIDEASTENABLED
SM_CYMAXTRACK SM_NETWORK
SM_CXMENUCHECK SM_PENWINDOWS
SM_CYMENUCHECK SM_SECURE
SM_CXMENUSIZE SM_SHOWSOUNDS
SM_CYMENUSIZE SM_SLOWMACHINE
SM_CXMIN SM_SWAPBUTTON
SM_CYMIN  

If the Windows CE–based device you are targeting supports a mouse cursor, you can use the SM_CXCURSOR or SM_CYCURSOR values in the nIndexparameter.

Windows CE versions that support mouse cursors include the Iconcurs and Mcursor components rather than the Icon and Cursor components.

When working with RAPI for Windows CE versions 1.0 and 1.01, use the PegGetSystemMetricsfunction.

Remarks

System metrics may vary from display to display.

The SM_ARRANGE setting specifies how the system arranges minimized windows, and consists of a starting position and a direction. The starting position can be one of the following values.

Value Description
ARW_BOTTOMLEFT Start at the lower-left corner of the screen (default position).
ARW_BOTTOMRIGHT Start at the lower-right corner of the screen. Equivalent to ARW_STARTRIGHT.
ARW_HIDE Hide minimized windows by moving them off the visible area of the screen.
ARW_TOPLEFT Start at the upper-left corner of the screen. Equivalent to ARV_STARTTOP.
ARW_TOPRIGHT Start at the upper-right corner of the screen. Equivalent to ARW_STARTTOP | SRW_STARTRIGHT.

The direction in which to arrange can be one of the following values.

Value Description
ARW_DOWN Arrange vertically, top to bottom.
ARW_LEFT Arrange horizontally, left to right.
ARW_RIGHT Arrange horizontally, right to left.
ARW_UP Arrange vertically, bottom to top.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h   Wmbase.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

GetDeviceCaps, GetLastError, LoadIcon, SystemParametersInfo