Resolution of monitor
Resolution of monitor
Hi,
The resolution of my monitor is 1920 x 1080. However, the ScrResolution() function returns
{ 1536, 864 }. Why ?
The resolution of my monitor is 1920 x 1080. However, the ScrResolution() function returns
{ 1536, 864 }. Why ?
- Rick Lipkin
- Posts: 2668
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Re: Resolution of monitor
Natter
Try it this way ...
This will give you the horizontal and vertical resolution ...
Rick Lipkin
Try it this way ...
Code: Select all | Expand
nSCR1 := GetSysMetrics(0)
nSCR2 := GetSysMetrics(1)
This will give you the horizontal and vertical resolution ...
Rick Lipkin
Re: Resolution of monitor
Hi Natter,
Because of Display Setup (Scale and Layout is 125%)
Because of Display Setup (Scale and Layout is 125%)
Natter wrote:Hi,
The resolution of my monitor is 1920 x 1080. However, the ScrResolution() function returns
{ 1536, 864 }. Why ?
Regards,
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
Dutch
FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
- Marc Venken
- Posts: 1482
- Joined: Tue Jun 14, 2016 7:51 am
- Location: Belgium
Re: Resolution of monitor
I believe that Uwe found a solution in this topic ....
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=34845&hilit=scale+monitor&sid=581ff73d708640259f7dd5d859b26a12
http://forums.fivetechsupport.com/viewtopic.php?f=3&t=34845&hilit=scale+monitor&sid=581ff73d708640259f7dd5d859b26a12
Marc Venken
Using: FWH 23.08 with Harbour
Using: FWH 23.08 with Harbour
Re: Resolution of monitor
Is there a function that can read the scaling of your desktop?
Thanks.
Thanks.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Re: Resolution of monitor
It is not possible to get DPI yet. It might be worth trying in the registry
Re: Resolution of monitor
hi,
there are different Way to get Scale-Factor.
for single Monitor you can use "real" / "virtual" Desktop Size to get Scale-Factor
---
for multi-Monitor you need
MonitorFromWindow https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-monitorfromwindow
GetScaleFactorForMonitor https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-getscalefactorformonitor
DEVICE_SCALE_FACTOR https://docs.microsoft.com/en-us/windows/win32/api/shtypes/ne-shtypes-device_scale_factor
GetScaleFactorForDevice is IMHO outdate
https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-getscalefactorfordevice
there are different Way to get Scale-Factor.
for single Monitor you can use "real" / "virtual" Desktop Size to get Scale-Factor
Code: Select all | Expand
#define HORZRES 0x0008 // ( 8) Horizontal width in pixels
#define VERTRES 0x000A // ( 10) Vertical width in pixels
#define LOGPIXELSX 0x0058 // ( 88) Logical pixels/inch in X
#define LOGPIXELSY 0x005A // ( 90) Logical pixels/inch in Y
#define DESKTOPVERTRES 0x0075 // (117) Vertical height of entire desktop in pixels
#define DESKTOPHORZRES 0x0076 // (118) Horizontal width of entire desktop in pixels
Function GetDeskSize(nHDC,lVirtual)
LOCAL nWidth,nHeight
nWidth := HMG_CallDLL('GDI32.dll', DLL_OSAPI, 'GetDeviceCaps', nHDC, iif(lVirtual, HORZRES, DESKTOPHORZRES))
nHeight := HMG_CallDLL('GDI32.dll', DLL_OSAPI, 'GetDeviceCaps', nHDC, iif(lVirtual, VERTRES, DESKTOPVERTRES))
RETURN{nWidth,nHeight}
---
for multi-Monitor you need
MonitorFromWindow https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-monitorfromwindow
GetScaleFactorForMonitor https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-getscalefactorformonitor
DEVICE_SCALE_FACTOR https://docs.microsoft.com/en-us/windows/win32/api/shtypes/ne-shtypes-device_scale_factor
GetScaleFactorForDevice is IMHO outdate
https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-getscalefactorfordevice
greeting,
Jimmy
Jimmy
- karinha
- Posts: 7910
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Resolution of monitor
Hi Jimmy, how do I do this in FiveWin? I don't use HMG.
Hola Jimmy, ¿cómo hago esto en FiveWin? No uso HMG.
Regards, saludos.
Hola Jimmy, ¿cómo hago esto en FiveWin? No uso HMG.
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: Resolution of monitor
hi karinha,
FiveWin have in c:\fwh\source\winapi\device.c
so as Natter wrote use
karinha wrote:how do I do this in FiveWin? I don't use HMG.
FiveWin have in c:\fwh\source\winapi\device.c
Code: Select all | Expand
HB_FUNC( GETDEVICECAPS ) // () HDC, int iIndex
so as Natter wrote use
Code: Select all | Expand
#define DESKTOPVERTRES 0x0075 // (117) Vertical height of entire desktop in pixels
#define DESKTOPHORZRES 0x0076 // (118) Horizontal width of entire desktop in pixels
Vertical := GetDeviceCaps(DC, 0x0075)
Horizontal := GetDeviceCaps(DC, 0x0076)
greeting,
Jimmy
Jimmy
- karinha
- Posts: 7910
- Joined: Tue Dec 20, 2005 7:36 pm
- Location: São Paulo - Brasil
- Been thanked: 3 times
- Contact:
Re: Resolution of monitor
Hola Jimmy, ¿puedes hacer un ejemplo completo y funcional? Necesito cambiar la RESOLUCIÓN DEL VIDEO a 1280x768 en tiempo real y luego volver a la RESOLUCIÓN DEL CLIENTE como estaba antes. ¿Es posible o no?
Hi Jimmy, can you make a complete and working example? I need to change the VIDEO RESOLUTION to 1280x768 in realtime, and then go back to CLIENT RESOLUTION as it was before. Is it possible or not?
WINDOW 7 and WINDOWS 10 please.
Gracias, thanks.
Origen:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=42143&sid=f7177597dbec68af574f19f84a5e1875
Regards, saludos.
Hi Jimmy, can you make a complete and working example? I need to change the VIDEO RESOLUTION to 1280x768 in realtime, and then go back to CLIENT RESOLUTION as it was before. Is it possible or not?
WINDOW 7 and WINDOWS 10 please.
Gracias, thanks.
Origen:
http://forums.fivetechsupport.com/viewtopic.php?f=6&t=42143&sid=f7177597dbec68af574f19f84a5e1875
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341