GetMonitorInfo Method (CLIENT)


10.0A

 

The GetMonitorInfo method provides monitor information for one or more display monitors on a Windows workstation. The method uses the following format:

 

[label]

{object}.GetMonitorInfo

[GIVING {return}] USING [*Options=]{options}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A CLIENT object.

return

Optional. A Character String Variable that receives the monitor information.

options

Optional. A Numeric Variable or decimal number that specifies a bit mask value that controls the operations of this method.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The EOS flag is set if the returned field data string must be truncated before being stored into the {return} Character variable.

  2. The ZERO flag is always cleared.

  3. The OVER flag is always cleared.

  4. The optional {options} bit mask values change the execution behavior of the GetMonitorInfo method as follows:

  5.  

    Option

    Returns

    0x0

    The default value which returns the data for all known monitors.

     

  6. The {return} character string contains monitor information that is formatted as follows:

  7.  

    "{hwnd},{type},{top},{bottom},{left},{right};{hwnd1},..."

     

    Where:

    {hwnd}
    HMONITOR handle of a display monitor. This value can be used in WINAPI instructions executed to perform user program operations for the display monitor.
    {type}
    This field is returned as a value of '1' which identifies that this is the Primary display monitor. A value of zero (0) indicates that the display monitor is a secondary monitor.
    {top}
    This field is a numeric value that is the display monitor top coordinate relative to the Workstation virtual screen. This value can be a negative coordinate value.
    {bottom}
    This field is a numeric value that is the display monitor bottom coordinate relative to the Workstation virtual screen. This value can be a negative coordinate value.
    {left}
    This field is a numeric value that is the display monitor left coordinate relative to the Workstation virtual screen. This value can be a negative coordinate value.
    {right}
    This field is a numeric value that is the display monitor right coordinate relative to the Workstation virtual screen. This value can be a negative coordinate value.

    Example return value using single display monitor:

     

    "65537,1,0,1050,0,1680;"

     

     '65537' is the HMONITOR handle

     

    '1' indicates this is the Primary monitor.

     

     '0' is the top coordinate value of the monitor.

     

    '1050' is the bottom coordinate value of the monitor.

     

    '0' is the left coordinate value of the monitor.

     

    '1680' is the right coordinate value of the monitor.

    Example using dual display monitors:

     

    "65537,1,0,1080,0,1920;65539,0,0,1080,-1920,0;"

     

    '65537' is the HMONITOR handle

     

    '1' indicates this is the Primary monitor.

     

     '0' is the top coordinate value of the monitor.

     

    '1080' is the bottom coordinate value of the monitor.

     

    '0' is the left coordinate value of the monitor.

     

    '1920' is the right coordinate value of the monitor.

    ----------

    '65539' is the HMONITOR handle of a secondary monitor

     

    '0' indicates this is not the Primary monitor.

     

    '0' is the top coordinate value of themonitor.

     

    '1080' is the bottom coordinate value of the monitor.

     

    '-1920' is the left coordinate value of the monitor. The negative value indicates that this secondary monitor is located to the left of the primary monitor for the Windows virtual screen.

     

    '0' is the right coordinate value ofthe monitor.

     

  8. When using the PWS runtime, the 'GetMonitorInfo' method returns client browser screen object information. In this case, the monitor information only provides single monitor data as found in the browser screen object.

  9. Example using PWS client browser:

     

    "0,1,0,1050,0,1680;"

     

    '0' is always zero for the HMONITOR handle.

     

    '1' is always one for the Primary monitor.

     

    '0' is the top coordinate value which is always zero.

     

    '1050' is the bottom coordinate value of the monitor identified by the height retrieved from the browser screen object.

     

     '0' is the left coordinate value which is always zero.

     

    '1680' is the right coordinate value of the monitor identified by the width retrieved from the browser screen object.

Example code using 'GetMonitorInfo':

 

cMonCnt

CONST

"5"

cl

CLIENT

 

MonArr

DIM

64(cMonCnt)

.

 

 

MonRec

RECORD

(cMonCnt)

hMonitor

FORM

11 //HMONITOR handle of monitor.

nPrimary

FORM

2 //Primary = 1 or Not Primary = 0

nTop

FORM

11 //Top coordinate in virtual screen

nBottom

FORM

11 //Bottom coordinate in virtual screen

nLeft

FORM

11 //Left coordinate in virtual screen

nRight

FORM

11 //Right coordinate in virtual screen

 

RECORDEND

 

.

 

 

DX

DIM

320

I

FORM

1

.

 

 

 

CLEAR

MonArr, MonRec

 

cl.GetMonitorInfo

GIVING S$CMDLIN

 

EXPLODE

S$CMDLIN, ";", MonArr

.

 

 

 

FOR

I,1,cMonCnt

.

 

 

 

TYPE

MonArr(I)

  

UNTIL

EOS

.

 

 

 

EXPLODE

MonArr(I), ",", MonRec(I)

.

 

 

 

REPEAT

 

.

 

 

 

STOP

 

 

 

See Also: CLIENT, Client Methods, Method Syntax

 



PL/B Language Reference GetLocation Method (CLIENT) GetState Method (CLIENT)