Partager via


GetSystemMetrics

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function retrieves the dimensions — widths and heights — of Windows display elements and system configuration settings. All dimensions retrieved by GetSystemMetrics are in pixels. The RAPI version is CeGetSystemMetrics (RAPI) for versions 2.0 and later.

Syntax

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_CMONITORS

    Number of display monitors on the Windows Embedded CE-based device. Supported in Windows CE .NET 4.0 and later.

    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_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_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_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_CXMENUCHECK, SM_CYMENUCHECK

    Dimensions, in pixels, of the default menu check-mark bitmap.

    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_CXSMICON, SM_CYSMICON

    Recommended dimensions, in pixels, of a small icon. Small icons typically appear in window captions and in small icon view.

    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 .NET 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_CYMENU

    Height, in pixels, of a single-line menu bar.

    SM_DEBUG

    TRUE or nonzero if the debugging version of USER.EXE is installed; FALSE or zero otherwise.

    SM_SAMEDISPLAYFORMAT

    TRUE if all the display monitors have the same color format, FALSE otherwise. Supported in Windows CE .NET 4.0 and later.

    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 .NET 4.0 and later.

Return Value

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

Remarks

Windows Embedded CE does not support the following nIndex values:

SM_ARRANGE

SM_CYMINIMIZED

SM_CLEANBOOT

SM_CXMINSPACING

SM_CMETRICS

SM_CYMINSPACING

SM_CMOUSEBUTTONS

SM_CXMINTRACK

SM_CXDRAG

SM_CYMINTRACK

SM_CYDRAG

SM_CXSIZE

SM_CXFRAME

SM_CYSIZE

SM_CYFRAME

SM_CXSIZEFRAME

SM_CXFULLSCREEN

SM_CYSIZEFRAME

SM_CYFULLSCREEN

SM_CXSMSIZE

SM_CXHTHUMB

SM_CYSMSIZE

SM_CYKANJIWINDOW

SM_CYSMCAPTION

SM_CXMAXIMIZED

SM_CYVTHUMB

SM_CYMAXIMIZED

SM_DBCSENABLED

SM_CXMAXTRACK

SM_MENUDROPALIGNMENT

SM_CYMAXTRACK

SM_MIDEASTENABLED

SM_CXMENUCHECK

SM_MOUSEPRESENT

SM_CYMENUCHECK

SM_MOUSEWHEELPRESENT

SM_CXMENUSIZE

SM_NETWORK

SM_CYMENUSIZE

SM_PENWINDOWS

SM_CXMIN

SM_SECURE

SM_CYMIN

SM_SHOWSOUNDS

SM_CXMINIMIZED

SM_SLOWMACHINE

 

SM_SWAPBUTTON

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

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

When working with RAPI in Windows CE 1.0 and 1.01, use the PegGetSystemMetrics function.

System metrics may vary from display to display.

The system metrics SM_CXICON, SM_CYICON, SM_CXICONSPACING, SM_CYICONSPACING, SM_CXSMICON, SM_CYSMICON, SM_CXCURSOR, SM_CYCURSOR return values in high dpi mode in Windows CE 5.0 and later.

Requirements

Header winuser.h
Library Wmbase.lib
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

GetDeviceCaps
LoadIcon
SystemParametersInfo
System Information Functions