Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for getsystemmetrics.cs

(view source code of getsystemmetrics.cs as plain text)

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.Runtime.InteropServices;
  5.  
  6.  
  7. namespace RobvanderWoude
  8. {
  9. 	class GetSystemMetricsWrapper
  10. 	{
  11. 		static string progver = "1.03";
  12.  
  13.  
  14. 		static int Main( string[] args )
  15. 		{
  16. 			#region Parse command line
  17.  
  18. 			bool listall = true;
  19. 			bool openurl = false;
  20. 			bool specificmetrics = false;
  21. 			List<string> metricargs = new List<string>( );
  22.  
  23. 			foreach ( string arg in args )
  24. 			{
  25. 				switch ( arg.ToUpper( ) )
  26. 				{
  27. 					case "/?":
  28. 						return ShowHelp( );
  29. 					case "/L":
  30. 						listall = true;
  31. 						break;
  32. 					case "/U":
  33. 						if ( openurl )
  34. 						{
  35. 							return ShowHelp( "Duplicate command line switch /U" );
  36. 						}
  37. 						openurl = true;
  38. 						break;
  39. 					default:
  40. 						if ( arg[0] == '/' )
  41. 						{
  42. 							return ShowHelp( "Invalid switch \"{0}\"", arg );
  43. 						}
  44. 						metricargs.Add( arg );
  45. 						specificmetrics = true;
  46. 						listall = false;
  47. 						break;
  48. 				}
  49.  
  50. 				if ( !listall && !specificmetrics )
  51. 				{
  52. 					return ShowHelp( "Specify at least one metric, or /L to list all" );
  53. 				}
  54.  
  55. 				if ( listall && specificmetrics )
  56. 				{
  57. 					return ShowHelp( "Either specify one or more metrics, or /L to list all, but not both" );
  58. 				}
  59. 			}
  60.  
  61. 			#endregion Parse command line
  62.  
  63. 			int rc = -1;
  64. 			string url = "https://msdn.microsoft.com/library/windows/desktop/ms724385.aspx";
  65.  
  66. 			// List all metrics and their values
  67. 			if ( listall )
  68. 			{
  69. 				ListAllMetrics( );
  70. 				rc = 0;
  71. 			}
  72. 			else
  73. 			{
  74. 				foreach ( string metricarg in metricargs )
  75. 				{
  76. 					// Get a single system metric value
  77. 					SystemMetric systemmetric;
  78. 					if ( Enum.TryParse<SystemMetric>( metricarg, true, out systemmetric ) )
  79. 					{
  80. 						rc = GetSystemMetrics( systemmetric );
  81. 						Console.WriteLine( "{0}={1}", Enum.GetName( typeof( SystemMetric ), systemmetric ), rc );
  82. 					}
  83. 					else
  84. 					{
  85. 						if ( metricargs.Count > 1 )
  86. 						{
  87. 							return ShowHelp( "Invalid metrics" );
  88. 						}
  89. 						else
  90. 						{
  91. 							return ShowHelp( "Invalid metric" );
  92. 						}
  93. 					}
  94. 				}
  95. 				if ( metricargs.Count > 0 )
  96. 				{
  97. 					rc = 0;
  98. 				}
  99. 			}
  100.  
  101. 			// Open the URL with the list of possible metric values
  102. 			if ( openurl )
  103. 			{
  104. 				Process process = new Process( );
  105. 				process.StartInfo = new ProcessStartInfo( url );
  106. 				process.Start( );
  107. 			}
  108.  
  109. 			return rc;
  110. 		}
  111.  
  112.  
  113. 		static void ListAllMetrics( )
  114. 		{
  115. 			SystemMetric systemmetric;
  116. 			// List all metric names and sort the list by name
  117. 			List<string> metricnames = new List<string>( Enum.GetNames( typeof( SystemMetric ) ) );
  118. 			metricnames.Sort( );
  119. 			// Determine longest metric name, to make all metric names fit in output table
  120. 			int maxstringlength = 0;
  121. 			foreach ( string metricname in metricnames )
  122. 			{
  123. 				if ( metricname.Length > maxstringlength )
  124. 				{
  125. 					maxstringlength = metricname.Length;
  126. 				}
  127. 			}
  128. 			// Show table head
  129. 			Console.WriteLine( "{0,-" + maxstringlength + "}    Index:              Value:", "Metric Name:" );
  130. 			Console.WriteLine( "{0,-" + maxstringlength + "}    ======              ======", "============" );
  131. 			// Show each metric name, index and value
  132. 			foreach ( string metricname in metricnames )
  133. 			{
  134. 				string metricvalue = new String( ' ', 20 );
  135. 				if ( Enum.TryParse<SystemMetric>( metricname, true, out systemmetric ) )
  136. 				{
  137. 					metricvalue = String.Format( "{0,20}", GetSystemMetrics( systemmetric ) );
  138. 				}
  139. 				if ( Enum.TryParse<SystemMetric>( metricname, true, out systemmetric ) )
  140. 				{
  141. 					Console.WriteLine( "{0,-" + maxstringlength + "}    {1,6}{2}", metricname, (int) systemmetric, metricvalue );
  142. 				}
  143. 				else
  144. 				{
  145. 					Console.WriteLine( "{0,-" + maxstringlength + "}         ?{1}", metricname, metricvalue );
  146. 				}
  147. 			}
  148. 		}
  149.  
  150.  
  151. 		static int ShowHelp( params string[] errmsg )
  152. 		{
  153. 			#region Error Message
  154.  
  155. 			if ( errmsg.Length > 0 )
  156. 			{
  157. 				List<string> errargs = new List<string>( errmsg );
  158. 				errargs.RemoveAt( 0 );
  159. 				Console.Error.WriteLine( );
  160. 				Console.ForegroundColor = ConsoleColor.Red;
  161. 				Console.Error.Write( "ERROR:\t" );
  162. 				Console.ForegroundColor = ConsoleColor.White;
  163. 				Console.Error.WriteLine( errmsg[0], errargs.ToArray( ) );
  164. 				Console.ResetColor( );
  165. 			}
  166.  
  167. 			#endregion Error Message
  168.  
  169. 			#region Help Text
  170.  
  171. 			/*
  172. 			GetSystemMetrics.exe,  Version 1.03
  173. 			Wrapper for the WINAPI (user32.dll) GetSystemMetrics function
  174.  
  175. 			Usage:    GetSystemMetrics.exe  [ metric [ metric [..] ] | /L ]  [ /U ]
  176.  
  177. 			Where:    metric     is the name or index of a SystemMetric to be queried
  178. 			                     (multiple metrics allowed)
  179. 			          /L         List all metrics names, indexes and values, sorted by name
  180. 			                     (default, implemented for backwards compatibility only)
  181. 			          /U         open URL with list of metric values and their meanings
  182.  
  183. 			Notes:    If a single metric is specified, the program's return code will
  184. 			          equal the value returned by the WINAPI GetSystemMetrics function,
  185. 			          for multiple metrics the return code will be 0, in case of
  186. 			          (command line) errors the return code will be -1.
  187. 			          The meaning of the returned metric values can be found at
  188. 			          https://msdn.microsoft.com/library/windows/desktop/ms724385.aspx
  189.  
  190. 			Credits:  SystemMetric enumeration published by Gabriel T. Sharp on PInvoke.net
  191. 			          http://pinvoke.net/default.aspx/Enums/SystemMetric.html
  192.  
  193. 			Written by Rob van der Woude
  194. 			http://www.robvanderwoude.com
  195. 			*/
  196.  
  197. 			Console.Error.WriteLine( );
  198.  
  199. 			Console.Error.WriteLine( "GetSystemMetrics.exe,  Version {0}", progver );
  200.  
  201. 			Console.Error.WriteLine( "Wrapper for the WINAPI (user32.dll) GetSystemMetrics function" );
  202.  
  203. 			Console.Error.WriteLine( );
  204.  
  205. 			Console.Error.Write( "Usage:    " );
  206. 			Console.ForegroundColor = ConsoleColor.White;
  207. 			Console.Error.WriteLine( "GetSystemMetrics.exe  [ metric [ metric [..] ] | /L ]  [ /U ]" );
  208. 			Console.ResetColor( );
  209.  
  210. 			Console.Error.WriteLine( );
  211.  
  212. 			Console.Error.Write( "Where:    " );
  213. 			Console.ForegroundColor = ConsoleColor.White;
  214. 			Console.Error.Write( "metric" );
  215. 			Console.ResetColor( );
  216. 			Console.Error.WriteLine( "     is the name or number of a SystemMetric to be queried" );
  217.  
  218. 			Console.Error.WriteLine( "                     (multiple metrics allowed)" );
  219.  
  220. 			Console.ForegroundColor = ConsoleColor.White;
  221. 			Console.Error.Write( "          /L         L" );
  222. 			Console.ResetColor( );
  223. 			Console.Error.WriteLine( "ist all metrics names, numbers and values, sorted by name" );
  224.  
  225. 			Console.Error.WriteLine( "                     (default, implemented for backwards compatibility only)" );
  226.  
  227. 			Console.ForegroundColor = ConsoleColor.White;
  228. 			Console.Error.Write( "          /U" );
  229. 			Console.ResetColor( );
  230. 			Console.Error.Write( "         open " );
  231. 			Console.ForegroundColor = ConsoleColor.White;
  232. 			Console.Error.Write( "U" );
  233. 			Console.ResetColor( );
  234. 			Console.Error.WriteLine( "RL with list of metric values and their meanings" );
  235.  
  236. 			Console.Error.WriteLine( );
  237.  
  238. 			Console.Error.WriteLine( "Notes:    If a single metric is specified, the program's return code will" );
  239.  
  240. 			Console.Error.WriteLine( "          equal the value returned by the WINAPI GetSystemMetrics function," );
  241.  
  242. 			Console.Error.WriteLine( "          for multiple metrics the return code will be 0, in case of" );
  243.  
  244. 			Console.Error.WriteLine( "          (command line) errors the return code will be -1." );
  245.  
  246. 			Console.Error.WriteLine( "          The meaning of the returned metric values can be found online at" );
  247.  
  248. 			Console.ForegroundColor = ConsoleColor.DarkGray;
  249. 			Console.Error.WriteLine( "          https://msdn.microsoft.com/library/windows/desktop/ms724385.aspx" );
  250. 			Console.ResetColor( );
  251.  
  252. 			Console.Error.WriteLine( );
  253.  
  254. 			Console.Error.WriteLine( "Credits:  SystemMetric enumeration published by Gabriel T. Sharp on PInvoke.net" );
  255.  
  256. 			Console.ForegroundColor = ConsoleColor.DarkGray;
  257. 			Console.Error.WriteLine( "          http://pinvoke.net/default.aspx/Enums/SystemMetric.html" );
  258. 			Console.ResetColor( );
  259.  
  260. 			Console.Error.WriteLine( );
  261.  
  262. 			Console.Error.WriteLine( "Written by Rob van der Woude" );
  263.  
  264. 			Console.Error.WriteLine( "http://www.robvanderwoude.com" );
  265.  
  266. 			#endregion Help Text
  267.  
  268. 			return -1;
  269. 		}
  270.  
  271.  
  272. 		[DllImport( "user32.dll" )]
  273. 		static extern int GetSystemMetrics( SystemMetric smIndex );
  274.  
  275.  
  276. 		/// <summary>
  277. 		/// Flags used with the Windows API (User32.dll):GetSystemMetrics(SystemMetric smIndex)
  278. 		///  
  279. 		/// This Enum and declaration signature was written by Gabriel T. Sharp
  280. 		/// ai_productions@verizon.net or osirisgothra@hotmail.com
  281. 		/// Obtained on pinvoke.net, please contribute your code to support the wiki!
  282. 		/// </summary>
  283. 		public enum SystemMetric : int
  284. 		{
  285. 			/// <summary>
  286. 			/// The flags that specify how the system arranged minimized windows. For more information, see the Remarks section in this topic.
  287. 			/// </summary>
  288. 			SM_ARRANGE = 56,
  289.  
  290. 			/// <summary>
  291. 			/// The value that specifies how the system is started:
  292. 			/// 0 Normal boot
  293. 			/// 1 Fail-safe boot
  294. 			/// 2 Fail-safe with network boot
  295. 			/// A fail-safe boot (also called SafeBoot, Safe Mode, or Clean Boot) bypasses the user startup files.
  296. 			/// </summary>
  297. 			SM_CLEANBOOT = 67,
  298.  
  299. 			/// <summary>
  300. 			/// The number of display monitors on a desktop. For more information, see the Remarks section in this topic.
  301. 			/// </summary>
  302. 			SM_CMONITORS = 80,
  303.  
  304. 			/// <summary>
  305. 			/// The number of buttons on a mouse, or zero if no mouse is installed.
  306. 			/// </summary>
  307. 			SM_CMOUSEBUTTONS = 43,
  308.  
  309. 			/// <summary>
  310. 			/// The width of a window border, in pixels. This is equivalent to the SM_CXEDGE value for windows with the 3-D look.
  311. 			/// </summary>
  312. 			SM_CXBORDER = 5,
  313.  
  314. 			/// <summary>
  315. 			/// The width of a cursor, in pixels. The system cannot create cursors of other sizes.
  316. 			/// </summary>
  317. 			SM_CXCURSOR = 13,
  318.  
  319. 			/// <summary>
  320. 			/// This value is the same as SM_CXFIXEDFRAME.
  321. 			/// </summary>
  322. 			SM_CXDLGFRAME = 7,
  323.  
  324. 			/// <summary>
  325. 			/// The width of the rectangle around the location of a first click in a double-click sequence, in pixels. ,
  326. 			/// The second click must occur within the rectangle that is defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system
  327. 			/// to consider the two clicks a double-click. The two clicks must also occur within a specified time.
  328. 			/// To set the width of the double-click rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKWIDTH.
  329. 			/// </summary>
  330. 			SM_CXDOUBLECLK = 36,
  331.  
  332. 			/// <summary>
  333. 			/// The number of pixels on either side of a mouse-down point that the mouse pointer can move before a drag operation begins.
  334. 			/// This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
  335. 			/// If this value is negative, it is subtracted from the left of the mouse-down point and added to the right of it.
  336. 			/// </summary>
  337. 			SM_CXDRAG = 68,
  338.  
  339. 			/// <summary>
  340. 			/// The width of a 3-D border, in pixels. This metric is the 3-D counterpart of SM_CXBORDER.
  341. 			/// </summary>
  342. 			SM_CXEDGE = 45,
  343.  
  344. 			/// <summary>
  345. 			/// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels.
  346. 			/// SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border.
  347. 			/// This value is the same as SM_CXDLGFRAME.
  348. 			/// </summary>
  349. 			SM_CXFIXEDFRAME = 7,
  350.  
  351. 			/// <summary>
  352. 			/// The width of the left and right edges of the focus rectangle that the DrawFocusRectdraws.
  353. 			/// This value is in pixels.
  354. 			/// Windows 2000:  This value is not supported.
  355. 			/// </summary>
  356. 			SM_CXFOCUSBORDER = 83,
  357.  
  358. 			/// <summary>
  359. 			/// This value is the same as SM_CXSIZEFRAME.
  360. 			/// </summary>
  361. 			SM_CXFRAME = 32,
  362.  
  363. 			/// <summary>
  364. 			/// The width of the client area for a full-screen window on the primary display monitor, in pixels.
  365. 			/// To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars,
  366. 			/// call the SystemParametersInfofunction with the SPI_GETWORKAREA value.
  367. 			/// </summary>
  368. 			SM_CXFULLSCREEN = 16,
  369.  
  370. 			/// <summary>
  371. 			/// The width of the arrow bitmap on a horizontal scroll bar, in pixels.
  372. 			/// </summary>
  373. 			SM_CXHSCROLL = 21,
  374.  
  375. 			/// <summary>
  376. 			/// The width of the thumb box in a horizontal scroll bar, in pixels.
  377. 			/// </summary>
  378. 			SM_CXHTHUMB = 10,
  379.  
  380. 			/// <summary>
  381. 			/// The default width of an icon, in pixels. The LoadIcon function can load only icons with the dimensions
  382. 			/// that SM_CXICON and SM_CYICON specifies.
  383. 			/// </summary>
  384. 			SM_CXICON = 11,
  385.  
  386. 			/// <summary>
  387. 			/// The width of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size
  388. 			/// SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CXICON.
  389. 			/// </summary>
  390. 			SM_CXICONSPACING = 38,
  391.  
  392. 			/// <summary>
  393. 			/// The default width, in pixels, of a maximized top-level window on the primary display monitor.
  394. 			/// </summary>
  395. 			SM_CXMAXIMIZED = 61,
  396.  
  397. 			/// <summary>
  398. 			/// The default maximum width of a window that has a caption and sizing borders, in pixels.
  399. 			/// This metric refers to the entire desktop. The user cannot drag the window frame to a size larger than these dimensions.
  400. 			/// A window can override this value by processing the WM_GETMINMAXINFO message.
  401. 			/// </summary>
  402. 			SM_CXMAXTRACK = 59,
  403.  
  404. 			/// <summary>
  405. 			/// The width of the default menu check-mark bitmap, in pixels.
  406. 			/// </summary>
  407. 			SM_CXMENUCHECK = 71,
  408.  
  409. 			/// <summary>
  410. 			/// The width of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels.
  411. 			/// </summary>
  412. 			SM_CXMENUSIZE = 54,
  413.  
  414. 			/// <summary>
  415. 			/// The minimum width of a window, in pixels.
  416. 			/// </summary>
  417. 			SM_CXMIN = 28,
  418.  
  419. 			/// <summary>
  420. 			/// The width of a minimized window, in pixels.
  421. 			/// </summary>
  422. 			SM_CXMINIMIZED = 57,
  423.  
  424. 			/// <summary>
  425. 			/// The width of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged.
  426. 			/// This value is always greater than or equal to SM_CXMINIMIZED.
  427. 			/// </summary>
  428. 			SM_CXMINSPACING = 47,
  429.  
  430. 			/// <summary>
  431. 			/// The minimum tracking width of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions.
  432. 			/// A window can override this value by processing the WM_GETMINMAXINFO message.
  433. 			/// </summary>
  434. 			SM_CXMINTRACK = 34,
  435.  
  436. 			/// <summary>
  437. 			/// The amount of border padding for captioned windows, in pixels. Windows XP/2000:  This value is not supported.
  438. 			/// </summary>
  439. 			SM_CXPADDEDBORDER = 92,
  440.  
  441. 			/// <summary>
  442. 			/// The width of the screen of the primary display monitor, in pixels. This is the same value obtained by calling 
  443. 			/// GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, HORZRES).
  444. 			/// </summary>
  445. 			SM_CXSCREEN = 0,
  446.  
  447. 			/// <summary>
  448. 			/// The width of a button in a window caption or title bar, in pixels.
  449. 			/// </summary>
  450. 			SM_CXSIZE = 30,
  451.  
  452. 			/// <summary>
  453. 			/// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels.
  454. 			/// SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
  455. 			/// This value is the same as SM_CXFRAME.
  456. 			/// </summary>
  457. 			SM_CXSIZEFRAME = 32,
  458.  
  459. 			/// <summary>
  460. 			/// The recommended width of a small icon, in pixels. Small icons typically appear in window captions and in small icon view.
  461. 			/// </summary>
  462. 			SM_CXSMICON = 49,
  463.  
  464. 			/// <summary>
  465. 			/// The width of small caption buttons, in pixels.
  466. 			/// </summary>
  467. 			SM_CXSMSIZE = 52,
  468.  
  469. 			/// <summary>
  470. 			/// The width of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors.
  471. 			/// The SM_XVIRTUALSCREEN metric is the coordinates for the left side of the virtual screen.
  472. 			/// </summary>
  473. 			SM_CXVIRTUALSCREEN = 78,
  474.  
  475. 			/// <summary>
  476. 			/// The width of a vertical scroll bar, in pixels.
  477. 			/// </summary>
  478. 			SM_CXVSCROLL = 2,
  479.  
  480. 			/// <summary>
  481. 			/// The height of a window border, in pixels. This is equivalent to the SM_CYEDGE value for windows with the 3-D look.
  482. 			/// </summary>
  483. 			SM_CYBORDER = 6,
  484.  
  485. 			/// <summary>
  486. 			/// The height of a caption area, in pixels.
  487. 			/// </summary>
  488. 			SM_CYCAPTION = 4,
  489.  
  490. 			/// <summary>
  491. 			/// The height of a cursor, in pixels. The system cannot create cursors of other sizes.
  492. 			/// </summary>
  493. 			SM_CYCURSOR = 14,
  494.  
  495. 			/// <summary>
  496. 			/// This value is the same as SM_CYFIXEDFRAME.
  497. 			/// </summary>
  498. 			SM_CYDLGFRAME = 8,
  499.  
  500. 			/// <summary>
  501. 			/// The height of the rectangle around the location of a first click in a double-click sequence, in pixels.
  502. 			/// The second click must occur within the rectangle defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider
  503. 			/// the two clicks a double-click. The two clicks must also occur within a specified time. To set the height of the double-click
  504. 			/// rectangle, call SystemParametersInfo with SPI_SETDOUBLECLKHEIGHT.
  505. 			/// </summary>
  506. 			SM_CYDOUBLECLK = 37,
  507.  
  508. 			/// <summary>
  509. 			/// The number of pixels above and below a mouse-down point that the mouse pointer can move before a drag operation begins.
  510. 			/// This allows the user to click and release the mouse button easily without unintentionally starting a drag operation.
  511. 			/// If this value is negative, it is subtracted from above the mouse-down point and added below it.
  512. 			/// </summary>
  513. 			SM_CYDRAG = 69,
  514.  
  515. 			/// <summary>
  516. 			/// The height of a 3-D border, in pixels. This is the 3-D counterpart of SM_CYBORDER.
  517. 			/// </summary>
  518. 			SM_CYEDGE = 46,
  519.  
  520. 			/// <summary>
  521. 			/// The thickness of the frame around the perimeter of a window that has a caption but is not sizable, in pixels.
  522. 			/// SM_CXFIXEDFRAME is the height of the horizontal border, and SM_CYFIXEDFRAME is the width of the vertical border.
  523. 			/// This value is the same as SM_CYDLGFRAME.
  524. 			/// </summary>
  525. 			SM_CYFIXEDFRAME = 8,
  526.  
  527. 			/// <summary>
  528. 			/// The height of the top and bottom edges of the focus rectangle drawn byDrawFocusRect.
  529. 			/// This value is in pixels.
  530. 			/// Windows 2000:  This value is not supported.
  531. 			/// </summary>
  532. 			SM_CYFOCUSBORDER = 84,
  533.  
  534. 			/// <summary>
  535. 			/// This value is the same as SM_CYSIZEFRAME.
  536. 			/// </summary>
  537. 			SM_CYFRAME = 33,
  538.  
  539. 			/// <summary>
  540. 			/// The height of the client area for a full-screen window on the primary display monitor, in pixels.
  541. 			/// To get the coordinates of the portion of the screen not obscured by the system taskbar or by application desktop toolbars,
  542. 			/// call the SystemParametersInfo function with the SPI_GETWORKAREA value.
  543. 			/// </summary>
  544. 			SM_CYFULLSCREEN = 17,
  545.  
  546. 			/// <summary>
  547. 			/// The height of a horizontal scroll bar, in pixels.
  548. 			/// </summary>
  549. 			SM_CYHSCROLL = 3,
  550.  
  551. 			/// <summary>
  552. 			/// The default height of an icon, in pixels. The LoadIcon function can load only icons with the dimensions SM_CXICON and SM_CYICON.
  553. 			/// </summary>
  554. 			SM_CYICON = 12,
  555.  
  556. 			/// <summary>
  557. 			/// The height of a grid cell for items in large icon view, in pixels. Each item fits into a rectangle of size
  558. 			/// SM_CXICONSPACING by SM_CYICONSPACING when arranged. This value is always greater than or equal to SM_CYICON.
  559. 			/// </summary>
  560. 			SM_CYICONSPACING = 39,
  561.  
  562. 			/// <summary>
  563. 			/// For double byte character set versions of the system, this is the height of the Kanji window at the bottom of the screen, in pixels.
  564. 			/// </summary>
  565. 			SM_CYKANJIWINDOW = 18,
  566.  
  567. 			/// <summary>
  568. 			/// The default height, in pixels, of a maximized top-level window on the primary display monitor.
  569. 			/// </summary>
  570. 			SM_CYMAXIMIZED = 62,
  571.  
  572. 			/// <summary>
  573. 			/// The default maximum height of a window that has a caption and sizing borders, in pixels. This metric refers to the entire desktop.
  574. 			/// The user cannot drag the window frame to a size larger than these dimensions. A window can override this value by processing
  575. 			/// the WM_GETMINMAXINFO message.
  576. 			/// </summary>
  577. 			SM_CYMAXTRACK = 60,
  578.  
  579. 			/// <summary>
  580. 			/// The height of a single-line menu bar, in pixels.
  581. 			/// </summary>
  582. 			SM_CYMENU = 15,
  583.  
  584. 			/// <summary>
  585. 			/// The height of the default menu check-mark bitmap, in pixels.
  586. 			/// </summary>
  587. 			SM_CYMENUCHECK = 72,
  588.  
  589. 			/// <summary>
  590. 			/// The height of menu bar buttons, such as the child window close button that is used in the multiple document interface, in pixels.
  591. 			/// </summary>
  592. 			SM_CYMENUSIZE = 55,
  593.  
  594. 			/// <summary>
  595. 			/// The minimum height of a window, in pixels.
  596. 			/// </summary>
  597. 			SM_CYMIN = 29,
  598.  
  599. 			/// <summary>
  600. 			/// The height of a minimized window, in pixels.
  601. 			/// </summary>
  602. 			SM_CYMINIMIZED = 58,
  603.  
  604. 			/// <summary>
  605. 			/// The height of a grid cell for a minimized window, in pixels. Each minimized window fits into a rectangle this size when arranged.
  606. 			/// This value is always greater than or equal to SM_CYMINIMIZED.
  607. 			/// </summary>
  608. 			SM_CYMINSPACING = 48,
  609.  
  610. 			/// <summary>
  611. 			/// The minimum tracking height of a window, in pixels. The user cannot drag the window frame to a size smaller than these dimensions.
  612. 			/// A window can override this value by processing the WM_GETMINMAXINFO message.
  613. 			/// </summary>
  614. 			SM_CYMINTRACK = 35,
  615.  
  616. 			/// <summary>
  617. 			/// The height of the screen of the primary display monitor, in pixels. This is the same value obtained by calling 
  618. 			/// GetDeviceCaps as follows: GetDeviceCaps( hdcPrimaryMonitor, VERTRES).
  619. 			/// </summary>
  620. 			SM_CYSCREEN = 1,
  621.  
  622. 			/// <summary>
  623. 			/// The height of a button in a window caption or title bar, in pixels.
  624. 			/// </summary>
  625. 			SM_CYSIZE = 31,
  626.  
  627. 			/// <summary>
  628. 			/// The thickness of the sizing border around the perimeter of a window that can be resized, in pixels.
  629. 			/// SM_CXSIZEFRAME is the width of the horizontal border, and SM_CYSIZEFRAME is the height of the vertical border.
  630. 			/// This value is the same as SM_CYFRAME.
  631. 			/// </summary>
  632. 			SM_CYSIZEFRAME = 33,
  633.  
  634. 			/// <summary>
  635. 			/// The height of a small caption, in pixels.
  636. 			/// </summary>
  637. 			SM_CYSMCAPTION = 51,
  638.  
  639. 			/// <summary>
  640. 			/// The recommended height of a small icon, in pixels. Small icons typically appear in window captions and in small icon view.
  641. 			/// </summary>
  642. 			SM_CYSMICON = 50,
  643.  
  644. 			/// <summary>
  645. 			/// The height of small caption buttons, in pixels.
  646. 			/// </summary>
  647. 			SM_CYSMSIZE = 53,
  648.  
  649. 			/// <summary>
  650. 			/// The height of the virtual screen, in pixels. The virtual screen is the bounding rectangle of all display monitors.
  651. 			/// The SM_YVIRTUALSCREEN metric is the coordinates for the top of the virtual screen.
  652. 			/// </summary>
  653. 			SM_CYVIRTUALSCREEN = 79,
  654.  
  655. 			/// <summary>
  656. 			/// The height of the arrow bitmap on a vertical scroll bar, in pixels.
  657. 			/// </summary>
  658. 			SM_CYVSCROLL = 20,
  659.  
  660. 			/// <summary>
  661. 			/// The height of the thumb box in a vertical scroll bar, in pixels.
  662. 			/// </summary>
  663. 			SM_CYVTHUMB = 9,
  664.  
  665. 			/// <summary>
  666. 			/// Nonzero if User32.dll supports DBCS; otherwise, 0.
  667. 			/// </summary>
  668. 			SM_DBCSENABLED = 42,
  669.  
  670. 			/// <summary>
  671. 			/// Nonzero if the debug version of User.exe is installed; otherwise, 0.
  672. 			/// </summary>
  673. 			SM_DEBUG = 22,
  674.  
  675. 			/// <summary>
  676. 			/// Nonzero if the current operating system is Windows 7 or Windows Server 2008 R2 and the Tablet PC Input
  677. 			/// service is started; otherwise, 0. The return value is a bitmask that specifies the type of digitizer input supported by the device.
  678. 			/// For more information, see Remarks.
  679. 			/// Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported.
  680. 			/// </summary>
  681. 			SM_DIGITIZER = 94,
  682.  
  683. 			/// <summary>
  684. 			/// Nonzero if Input Method Manager/Input Method Editor features are enabled; otherwise, 0.
  685. 			/// SM_IMMENABLED indicates whether the system is ready to use a Unicode-based IME on a Unicode application.
  686. 			/// To ensure that a language-dependent IME works, check SM_DBCSENABLED and the system ANSI code page.
  687. 			/// Otherwise the ANSI-to-Unicode conversion may not be performed correctly, or some components like fonts
  688. 			/// or registry settings may not be present.
  689. 			/// </summary>
  690. 			SM_IMMENABLED = 82,
  691.  
  692. 			/// <summary>
  693. 			/// Nonzero if there are digitizers in the system; otherwise, 0. SM_MAXIMUMTOUCHES returns the aggregate maximum of the
  694. 			/// maximum number of contacts supported by every digitizer in the system. If the system has only single-touch digitizers,
  695. 			/// the return value is 1. If the system has multi-touch digitizers, the return value is the number of simultaneous contacts
  696. 			/// the hardware can provide. Windows Server 2008, Windows Vista, and Windows XP/2000:  This value is not supported.
  697. 			/// </summary>
  698. 			SM_MAXIMUMTOUCHES = 95,
  699.  
  700. 			/// <summary>
  701. 			/// Nonzero if the current operating system is the Windows XP, Media Center Edition, 0 if not.
  702. 			/// </summary>
  703. 			SM_MEDIACENTER = 87,
  704.  
  705. 			/// <summary>
  706. 			/// Nonzero if drop-down menus are right-aligned with the corresponding menu-bar item; 0 if the menus are left-aligned.
  707. 			/// </summary>
  708. 			SM_MENUDROPALIGNMENT = 40,
  709.  
  710. 			/// <summary>
  711. 			/// Nonzero if the system is enabled for Hebrew and Arabic languages, 0 if not.
  712. 			/// </summary>
  713. 			SM_MIDEASTENABLED = 74,
  714.  
  715. 			/// <summary>
  716. 			/// Nonzero if a mouse is installed; otherwise, 0. This value is rarely zero, because of support for virtual mice and because
  717. 			/// some systems detect the presence of the port instead of the presence of a mouse.
  718. 			/// </summary>
  719. 			SM_MOUSEPRESENT = 19,
  720.  
  721. 			/// <summary>
  722. 			/// Nonzero if a mouse with a horizontal scroll wheel is installed; otherwise 0.
  723. 			/// </summary>
  724. 			SM_MOUSEHORIZONTALWHEELPRESENT = 91,
  725.  
  726. 			/// <summary>
  727. 			/// Nonzero if a mouse with a vertical scroll wheel is installed; otherwise 0.
  728. 			/// </summary>
  729. 			SM_MOUSEWHEELPRESENT = 75,
  730.  
  731. 			/// <summary>
  732. 			/// The least significant bit is set if a network is present; otherwise, it is cleared. The other bits are reserved for future use.
  733. 			/// </summary>
  734. 			SM_NETWORK = 63,
  735.  
  736. 			/// <summary>
  737. 			/// Nonzero if the Microsoft Windows for Pen computing extensions are installed; zero otherwise.
  738. 			/// </summary>
  739. 			SM_PENWINDOWS = 41,
  740.  
  741. 			/// <summary>
  742. 			/// This system metric is used in a Terminal Services environment to determine if the current Terminal Server session is
  743. 			/// being remotely controlled. Its value is nonzero if the current session is remotely controlled; otherwise, 0.
  744. 			/// You can use terminal services management tools such as Terminal Services Manager (tsadmin.msc) and shadow.exe to
  745. 			/// control a remote session. When a session is being remotely controlled, another user can view the contents of that session
  746. 			/// and potentially interact with it.
  747. 			/// </summary>
  748. 			SM_REMOTECONTROL = 0x2001,
  749.  
  750. 			/// <summary>
  751. 			/// This system metric is used in a Terminal Services environment. If the calling process is associated with a Terminal Services
  752. 			/// client session, the return value is nonzero. If the calling process is associated with the Terminal Services console session,
  753. 			/// the return value is 0.
  754. 			/// Windows Server 2003 and Windows XP:  The console session is not necessarily the physical console.
  755. 			/// For more information, seeWTSGetActiveConsoleSessionId.
  756. 			/// </summary>
  757. 			SM_REMOTESESSION = 0x1000,
  758.  
  759. 			/// <summary>
  760. 			/// Nonzero if all the display monitors have the same color format, otherwise, 0. Two displays can have the same bit depth,
  761. 			/// but different color formats. For example, the red, green, and blue pixels can be encoded with different numbers of bits,
  762. 			/// or those bits can be located in different places in a pixel color value.
  763. 			/// </summary>
  764. 			SM_SAMEDISPLAYFORMAT = 81,
  765.  
  766. 			/// <summary>
  767. 			/// This system metric should be ignored; it always returns 0.
  768. 			/// </summary>
  769. 			SM_SECURE = 44,
  770.  
  771. 			/// <summary>
  772. 			/// The build number if the system is Windows Server 2003 R2; otherwise, 0.
  773. 			/// </summary>
  774. 			SM_SERVERR2 = 89,
  775.  
  776. 			/// <summary>
  777. 			/// Nonzero if the user requires an application to present information visually in situations where it would otherwise present
  778. 			/// the information only in audible form; otherwise, 0.
  779. 			/// </summary>
  780. 			SM_SHOWSOUNDS = 70,
  781.  
  782. 			/// <summary>
  783. 			/// Nonzero if the current session is shutting down; otherwise, 0. Windows 2000:  This value is not supported.
  784. 			/// </summary>
  785. 			SM_SHUTTINGDOWN = 0x2000,
  786.  
  787. 			/// <summary>
  788. 			/// Nonzero if the computer has a low-end (slow) processor; otherwise, 0.
  789. 			/// </summary>
  790. 			SM_SLOWMACHINE = 73,
  791.  
  792. 			/// <summary>
  793. 			/// Nonzero if the current operating system is Windows 7 Starter Edition, Windows Vista Starter, or Windows XP Starter Edition; otherwise, 0.
  794. 			/// </summary>
  795. 			SM_STARTER = 88,
  796.  
  797. 			/// <summary>
  798. 			/// Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0.
  799. 			/// </summary>
  800. 			SM_SWAPBUTTON = 23,
  801.  
  802. 			/// <summary>
  803. 			/// Nonzero if the current operating system is the Windows XP Tablet PC edition or if the current operating system is Windows Vista
  804. 			/// or Windows 7 and the Tablet PC Input service is started; otherwise, 0. The SM_DIGITIZER setting indicates the type of digitizer
  805. 			/// input supported by a device running Windows 7 or Windows Server 2008 R2. For more information, see Remarks.
  806. 			/// </summary>
  807. 			SM_TABLETPC = 86,
  808.  
  809. 			/// <summary>
  810. 			/// The coordinates for the left side of the virtual screen. The virtual screen is the bounding rectangle of all display monitors.
  811. 			/// The SM_CXVIRTUALSCREEN metric is the width of the virtual screen.
  812. 			/// </summary>
  813. 			SM_XVIRTUALSCREEN = 76,
  814.  
  815. 			/// <summary>
  816. 			/// The coordinates for the top of the virtual screen. The virtual screen is the bounding rectangle of all display monitors.
  817. 			/// The SM_CYVIRTUALSCREEN metric is the height of the virtual screen.
  818. 			/// </summary>
  819. 			SM_YVIRTUALSCREEN = 77,
  820. 		}
  821. 	}
  822. }
  823.  

page last uploaded: 2017-08-21, 14:26