Page 1 of 1
To find screen resolution
Posted: Mon Oct 15, 2018 9:00 am
by Eugene Lutsenko
I use the commands below to find out the screen resolution. If it is less than necessary for the output of the graphic form, then I give the appropriate message. Recently discovered that on some computers, instead of the 1920 resolution, 1576 is defined. How to deal with this?
Code: Select all
nWidth := AppDeskTop():currentSize()[1] // current screen size width in pixels
nHeight := AppDeskTop():currentSize()[2] // current screen size height in pixels
Re: To find screen resolution
Posted: Mon Oct 15, 2018 11:57 am
by Auge_Ohr
Eugene Lutsenko wrote:1576 is defined. How to deal with this?
Code: Select all
nWidth := AppDeskTop():currentSize()[1] // current screen size width in pixels
nHeight := AppDeskTop():currentSize()[2] // current screen size height in pixels
hm ... 1576 is unusual
many big Monitor default use Scaling > 100% so AppDeskTop():currentSize() does not return native Monitor Size.
this Code show how to get native Monitor Size so you can calculate Scaling Faktor
Code: Select all
#include "dll.ch"
#define DESKTOPVERTRES 117
#define DESKTOPHORZRES 118
PROCEDURE MAIN
LOCAL hDC := GetDC(0)
LOCAL nDHORZRES := GetDeviceCaps( hDC, DESKTOPHORZRES ) // native Monitor Size !
LOCAL nDVERTRES := GetDeviceCaps( hDC, DESKTOPVERTRES ) // native Monitor Size !
? AppDesktop():Currentsize()
? nDHORZRES , nDVERTRES
ReleaseDC( 0, hDC )
WAIT
RETURN
DLLFUNCTION GetDC( nHWND ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ReleaseDC( nHWND, nHDC ) USING STDCALL FROM USER32.DLL
DLLFUNCTION GetDeviceCaps( nHWND, nIndex ) USING STDCALL FROM GDI32.DLL
! Note : link with /PM:PM
Re: To find screen resolution
Posted: Thu Oct 18, 2018 6:37 am
by rdonnay
You should use DC_GetWorkArea().
This will give you the "usable" portion of the screen.
You don't want to write over the taskbar area.