To find screen resolution

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

To find screen resolution

#1 Post 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

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: To find screen resolution

#2 Post 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
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: To find screen resolution

#3 Post 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.
The eXpress train is coming - and it has more cars.

Post Reply