GetSystemMetrics functions in the Win32 API

Source: Internet
Author: User
Tags sprintf

1.
Sm_arrange: Used to illustrate how the system arranges minimized windows, depending on the system data of the monitor may be different. It contains a starting position and direction. I haven't seen such a code about how to use it in a program.

The starting position can be one of the following values:
Arw_bottomleft: Start the screen in the lower left corner (the default value).
Arw_bottomright: Start at the bottom right corner of the screen (equivalent to arw_startright).
Arw_hide: Hides and minimizes the window in the visible area of the screen.
Arw_topleft: From the upper left corner of the screen (equivalent to arw_starttop).
Arw_topright: Start on the screen in the upper right corner (equivalent to Arw_starttop | Arw_startright).

The direction of the arrangement can be one of the following values:
Arw_down: vertically arranged from top to bottom.
ARW_UP: vertically arranged from bottom to top.
Arw_left: Arranges horizontally from left to right.
Arw_right: Arranges horizontally from right to left.

2.
Sm_cleanboot returns the way the system is started.
0: Normal start.
1: Safe mode starts.
2: Network security mode is started.
code example:
Nboot = GetSystemMetrics (sm_cleanboot);
Switch (nboot)
{
Case 0:
MessageBox (Null,text ("Normal boot System!"), TEXT ("hint"), MB_OK);
Break
Case 1:
MessageBox (Null,text ("Safe Mode boot System!"), TEXT ("hint"), MB_OK);
Break
Case 2:
MessageBox (Null,text ("Network Safe Mode Boot system!"), TEXT ("hint"), MB_OK);
Break
}

3,
Sm_cmousebuttons: The return value is the number of mouse keys supported by the system and returns 0 without the mouse installed in the system.
code:
nmousebutton = GetSystemMetrics (SM_ Cmousebuttons);
  sprintf (Szbuffer, "%d", Nmousebutton);
  messagebox (Null,szbuffer,text ("system supports mouse Keys"), MB_OK | mb_iconinformation);

4.
Sm_cxborder, Sm_cyborder: Returns the width and height of the Windows border, in pixels, equivalent to Sm_cxedge if it is in 3D form.
Code:
int cxborder = 0;
int cyborder = 0;

Cxborder =getsystemmetrics (Sm_cxborder);
Cyborder =getsystemmetrics (Sm_cyborder);

sprintf (Szbuffer, "the window's border length:%d, Width:%d", cxborder,cyborder);
MessageBox (Null,szbuffer,text ("Border Information"), MB_OK);

5.
Sm_cxcursor, Sm_cycursor: Returns the width and height of the standard cursor in pixels.
Code:
int cxcursor = 0;
int cycursor = 0;

Cxcursor = GetSystemMetrics (sm_cxcursor);
Cycursor =getsystemmetrics (sm_cycursor);

sprintf (szbuffer, "system standard cursor width is:%d, height is:%d", cxcursor,cycursor);
MessageBox (Null,szbuffer,text ("cursor Information"), MB_OK);

6,
Sm_cxdlgframe, Sm_cydlgframe: equivalent to Sm_cxfixedframe, Sm_cyfixedframe.
sm_cxfixedframe, Sm_cyfixedframe: The border thickness around a window (usually a dialog box) that has a caption but cannot resize.
//the thickness here and the length and width of the top border are the parts of the window respectively
// The values obtained on my system are Cxborder = Cyborder = 1;cxframe = Cyframe = 3;
// > You want to know the pros.

   Cxframe =getsystemmetrics (sm_cxdlgframe);
   cyframe =getsystemmetrics (sm_cydlgframe);

sprintf (Szbuffer, "the thickness of the border is:%d, height is:%d", cxframe,cyframe);
MessageBox (Null,szbuffer,text ("Border Information"), MB_OK);

7.
SM_CXDOUBLECLK, SMCYDOUBLECLK: Double-click a valid rectangular area in pixel values.
Code:
int cxdoublerect = 0;
int cydoublerect = 0;

Cxdoublerect = GetSystemMetrics (SM_CXDOUBLECLK);
Cydoublerect =getsystemmetrics (SM_CYDOUBLECLK);

sprintf (Szbuffer, "effective area width:%d, H:%d", cydoublerect,cydoublerect);
MessageBox (Null,szbuffer,text ("Active Area Information"), MB_OK);
The result is Cxdoublerect = 4,cydoublerect = 4;

8.
Sm_cxframe, Sm_cyframe: equivalent to Sm_cxsizeframe, sm_cysizeframe
Sm_cxsizeframe, Sm_cysizeframe: The thickness around the window border that can be resized.

9.
Sm_cxfullscreen, Sm_cyfullscreen: The width and height of the window area of the full-screen window.

10.
Sm_cxhscroll, Sm_cyhscroll: The width of the horizontal scroll bar and the height of the arrows on the horizontal scrollbar.
Code:

int cxhscroll = 0;
int cyhscroll = 0;

Cxhscroll = GetSystemMetrics (Sm_cxhscroll);
Cyhscroll =getsystemmetrics (Sm_cyhscroll);

sprintf (szbuffer, "Horizontal scrollbar Height:%d, arrowhead height:%d", cxhscroll,cyhscroll);
MessageBox (Null,szbuffer,text ("TIP"), MB_OK);

11.
Sm_cxhthumb: Width of the slider on the horizontal scroll bar

12.
Sm_cxicon, Sm_cyicon: The width and height of the system default icon (typically 32x32).

13.
Sm_cxiconspacing, sm_cyiconspacing: The distance between icons when viewing item as a large icon, which is always greater than Sm_cxicon and Sm_cyicon.

14.
Sm_cxmaximized, sm_cymaximized: The default size of the maximized window at the top level.

15.
Sm_cxmaxtrack, Sm_cymaxtrack: Has a default size that can change the size border and title bar window, and if the window size is larger than this size, the window is not movable.

16.
Sm_cxmenucheck, Sm_cymenucheck: Calculates the dimensions of the menu check mark bitmap in pixels.

17.,
Sm_cxmenusize, Sm_cymenusize: Calculates the size of the menu bar button in pixels.

18.
Sm_cxmin, Sm_cymin: The smallest size the window can reach.

19.
Sm_cxminimized, sm_cyminimized, the size of the normal minimized window.

20.
Sm_cxmintrack, Sm_cymintrack: Minimum tracking distance, the window does not move when the drag window distance is less than this value.

21st
Sm_cxscreen, Sm_cyscreen: Calculates the screen size in pixels .

22.
Sm_cxsize, Sm_cysize: Calculates the size of the title bar button in pixels.

23.
Sm_cxsmicon, Sm_cysmicon: small icon size in pixels, small icons generally appear on the title bar

24.
Sm_cxvscroll,
Sm_cyvscroll the width of the vertical scrollbar calculated in pixels and the height of the arrows on the vertical scroll bar

25.
Sm_cycaption the height of a normal window caption calculated in pixels

26.
Sm_cymenu the height of a single menu bar calculated in pixels

27.
Sm_cysmcaption the height of the small title bar of a window calculated in pixels

28.
Sm_cyvthumb the height of a scroll block in a vertical scrollbar calculated in pixels

29.
sm_dbcsenabled if a value of true or not 0 indicates that the system has a double-byte version of USER.EXE installed, false or 0 is not.

30.
Sm_debug if the value of TRUE or not 0 indicates that the system has a debug version of USER.EXE installed, false or 0 is not.

31.
Sm_menudropalignment if the value is true or not 0, the drop-down menu is right-aligned or left-aligned.

32.
Sm_mousepresent if a value of true or not 0 is installed, the mouse is not installed.

33.
Sm_mousewheelpresent a Wheel Mouse is installed if the value is true or not 0, otherwise it is not installed. (Windows ntonly).

34.
Sm_swapbutton if TRUE or not a value of 0 then the mouse key is exchanged or not.

GetSystemMetrics functions in the Win32 API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.