Kbase P160993: 4GL/ABL: An include file defining all the System Metrics accessible by the GetSystemMetrics WIN API
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/02/2010 |
|
Status: Unverified
GOAL:
4GL/ABL: An include file defining all the System Metrics accessible by the GetSystemMetrics WIN API function.
GOAL:
What type of information can the WIN API GetSystemMetrics function provide?
GOAL:
What are the meanings of each System Metric that can be used as INPUT parameter for the GetSystemMetrics WIN API function?
GOAL:
What is the syntax of invoking the WIN API GetSystemMetrics function?
FACT(s) (Environment):
Windows
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)
FIX:
GetSystemMetrics WIN API function has many many possible INTEGER INPUT parameters to query the system about many of its configurations and settings. Attached in the note below is a cut and paste ready include file that defines and explains all the System Metrics and Configuration Settings that can be accessed by invoking this powerful API function.
This include file may be used by the developer community as a source code ready to be integrated in their applications or as a reference listing documenting each of these settings and their return values.
In addition to the system metrics definitions, the include file also contains the 4GL/ABL code of the GetSystemMetrics WIN API function itself. The following code snippet demonstrates how to use this include file to easily invoke the GetSystemMetrics WIN API function and get the number of monitors attached to the current Windows desktop and the width, in pixels of each:
{GetSystemMetrics.i}.
DEFINE VARIABLE iNumberOfMonitors AS INTEGER NO-UNDO.
DEFINE VARIABLE iWidthOfPrimaryMonitor AS INTEGER NO-UNDO.
DEFINE VARIABLE iWidthOfBothMonitors AS INTEGER NO-UNDO.
DEFINE VARIABLE iWidthOfSecondaryMonitor AS INTEGER NO-UNDO.
/* Get the number of Monitors connected to the desktop */
RUN GetSystemMetrics (INPUT {&SM_CMONITORS}, OUTPUT iNumberOfMonitors).
/* Get the width of the Primary Monitor in pixels */
RUN GetSystemMetrics (INPUT {&SM_CXSCREEN}, OUTPUT iWidthOfPrimaryMonitor).
/* Get the width of the Primary Monitor in pixels */
RUN GetSystemMetrics (INPUT {&SM_CXVIRTUALSCREEN}, OUTPUT iWidthOfBothMonitors).
/* Get the width of the Secondary Monitor in pixels */
ASSIGN
iWidthOfSecondaryMonitor = iWidthOfBothMonitors - iWidthOfPrimaryMonitor.
MESSAGE
"Number of the desktop monitors :~t" iNumberOfMonitors "~n"
"Width of the primary monitor in pixels:~t" iWidthOfPrimaryMonitor "~n"
"Width of the both monitor in pixels:~t" iWidthOfBothMonitors "~n"
"Width of the secondary monitor in pixels:~t" iWidthOfSecondaryMonitor
VIEW-AS ALERT-BOX INFO BUTTONS OK.