Get acceptable Max Screen Width on Dualview

NobbyLK

New Member
Hi All,
how can i recieve the max Screen Resolution in Width & Column on a Dual View workplace.
session:width-pixels only shows one Monitor but not both.
I also need to check if a second Monitor is available - to get the max
row an column values.
Has anybody got some suggestions ?
cu
NobbyLK
 

NobbyLK

New Member
Sometimes - time will tell ;-)

Hi i think i have solved my above problem.
Der is a API Call "GetSystemMetrics" where you can adress constant Nr. 78 & 79 with the desktop Width & Height.
PROCEDURE GetSystemMetrics EXTERNAL "user32":
DEFINE INPUT PARAMETER nIndex AS LONG.
DEFINE RETURN PARAMETER ret AS LONG.
END.

DEFINE VARIABLE WIDTH AS INTEGER NO-UNDO.
DEFINE VARIABLE HEIGHT AS INTEGER NO-UNDO.

RUN GetSystemMetrics (INPUT 78, OUTPUT WIDTH).
RUN GetSystemMetrics (INPUT 79, OUTPUT HEIGHT).

It seems to work.
cu
NobbyLK
 

D.Cook

Member
Build virtual screen rectangle

An old thread but helpful, thanks.

Something to consider is that the primary monitor may not always be the top-left-most monitor. Using a couple more API calls you can build a 'virtual screen' -- image the smallest rectangle that you can draw to fit all of the monitors in.
The top-left of the primary monitor is the reference point (0,0), so if you have another monitor to the left or above the primary monitor, vscreen_left and vscreen_top will be negative.

You can use these values to compare against window X and Y attributes for example.
Code:
run GetSystemMetrics (76 /*SM_XVIRTUALSCREEN*/,  output vscreen_left).
run GetSystemMetrics (77 /*SM_YVIRTUALSCREEN*/,  output vscreen_top).
run GetSystemMetrics (78 /*SM_CXVIRTUALSCREEN*/, output vscreen_right).
vscreen_right = vscreen_left + vscreen_right.
run GetSystemMetrics (79 /*SM_CYVIRTUALSCREEN*/, output vg_vscreen_bottom).
vscreen_bottom = vscreen_top + vscreen_bottom.

GetSystemMetrics ref: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx

This doesn't necessarily provide an exact indication of the actual viewable area, because multiple monitors may be different sizes or placed offset to each other, but it is close enough for most applications. If anyone has written code to enumerate each monitor's dimensions I'd love to see it :)
 
Top