What is your setup? I'm asking because I have a 4K* monitor, if I size my program's window to make it fit the resolution it is usually too big for HD (1920x1080) but one for HD is tiny. Just wondering whether it's worthwile to adjust things on startup (sizes, fonts etc.).
My setup is
graphics NVIDIA GeForce RTX 3070 Ti
primary monitor 3840x2160, 100% DPI (I cheat, desktop icons are bigger via ctrl+mousewheel)
second monitor 1200x1920, 100% DPI (portrait, to view documents)
*4K: memory=4096, disk=4000, monitor=3840 :rolleyes:
It might lead to problems with dialog designers ?
Two 24 " Samsung curved FullHD monitors.
24" LED Monitor C24F390FHA with Curved Display
You never know what any particular users screen resolution might be. Are they on a laptop?, are they using ancient hardware?
I generally assume a user has monitor( or laptop screen) no larger than the legacy 1024 px. width x 768 px. height... that is if I expect others to use my programs.
Dynamically resizing to fit larger dimensions is possible of course, but to do it properly is both time consuming and produces a lot of extra code. You could do it in WM_PAINT I assume (never really tried it), but stretching to fit larger dimensions seems a less than optimal approach.
My desktop monitor is currently 1600x900 recommended size. The laptop is 1920x1080. Anything larger I consider a television, or home theater. (To be viewed at a distance) But that's just my personal opinion. :tongue:
1920x1080 here
1920x1080 with my newest Intel hd graphics card,15 inch laptop optional I use 40 inch 1920x1080 resolution as external monitor
You could use screen mode winapi to change screen resolution if user agrees, thinking if you made slow gdi game drawing using 4k hires it becomes too slow stretchblt up sizing to 4k
Consider change character size to different sizes by user,too tiny text might be harder to read on 4k monitor compared to lower resolution
I already got trouble earlier with make game for 1366x768 widescreen laptop monitor and other members tried game had 1024x768 monitors had trouble, that's also something think about
Monitor 1 (Main)
LG 27GL850
Resolution 2560x1440 pixels
Frequency 144 Hz
Monitor 2 (Side)
LG 24EN43
Resolution 1920x1080 pixels
Frequency 60 Hz
High DPI Desktop Application Development on Windows (https://learn.microsoft.com/en-us/windows/win32/hidpi/high-dpi-desktop-application-development-on-windows)
The drawback is that most of the High DPI API is for Windows 10 and higher.
1600 x 1200 here.
Maybe if we get enough data points here we can determine what a "typical" or "average" screen resolution is, at least as a kind of starting point.
Also, I have this special setting set in Control Panel (dunno what it's actually called) that sets my preference for the sizes of things, which may effect screen resolution settings for programs:
(https://i.postimg.cc/Mfxg7NzN/Control-Panel-display.jpg) (https://postimg.cc/Mfxg7NzN)
On this HP AIO: 1920 x 1080 here as well :smiley:
1. Video Adapter > UHD 4096/2160
EVGA GeForce GTX 970 4GB GDDR5 SSC ACX Coo
1190Mhz Clock, 7010Mhz Memory PCI Express 3.0, DVI, HDMI, 3x Display Port
2. 4096 x 2160 -> Samsung UN55JU6700FXZC - 55" Curved UHD 4K Smart LED TV
This discussion raises a couple interesting questions.
No. 1, how do you get the resolution programmatically? (Win32 here)
Answer: easily, but you might get conflicting results, depending on what method you use.
Small li'l utility (command line "console" app) attached below. It uses two methods:
- EnumDisplaySettings()
- GetSystemMetrics()
> getdisplayres
Values from EnumDisplaySettings():
Display resolution: 1600 X 1200
Values from GetSystemMetrics():
Display resolution: 1209 X 907
I think, but am not sure, that the discrepancy may be due to that Control Panel setting I showed above.
There's yet a third way,
GetDeviceCaps() which is 'spozed to give the same results as
GetSystemMetrics() which I haven't tried yet.
The next interesting question is OK, wise guy: so now you know the user's display resolution. What are you going to do about it?
That, of course, is a rather more open-ended and wide-ranging discussion.
Anyhow.
Values from EnumDisplaySettings():
Display resolution: 1600 X 900
Values from GetSystemMetrics():
Display resolution: 1600 X 900
:biggrin:
Why the discrepancy in yours NoCforMe, between the two?
I looked at the image in your previous post, found the answer. :tongue:
Well, is that the answer?
I can't think what else it would be.
Aaaaaargh.
Using browser
What Is My Screen Resolution? (https://www.whatismyip.com/screen-resolution/)
@NoCforMe thanks for hinting this
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
int __cdecl main(void)
{
DEVMODE dm;
dm.dmSize = sizeof(dm);
//EnumDisplaySettings("\\\\.\\DISPLAY1", ENUM_CURRENT_SETTINGS, &dm);
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm);
printf("%d x %d\n", dm.dmPelsWidth, dm.dmPelsHeight);
return 0;
}
EDIT: for poasm
; ml.exe -coff hello.asm -link -subsystem:console
.386
.model flat
option casemap:none
exit PROTO C :DWORD
printf PROTO C :PTR,:VARARG
INCLUDELIB msvcrt
EnumDisplaySettingsA PROTO STDCALL :PTR, :DWORD, :PTR
INCLUDELIB user32.lib
POINTL struct
x DWORD ?
y DWORD ?
POINTL ends
DEVMODEX struct
dmDeviceName BYTE 32 dup (?)
dmSpecVersion WORD ?
dmDriverVersion WORD ?
dmSize WORD ?
dmDriverExtra WORD ?
dmFields DWORD ?
union
struct
dmOrientation SWORD ?
dmPaperSize SWORD ?
dmPaperLength SWORD ?
dmPaperWidth SWORD ?
ends
dmPosition POINTL <?>
ends
dmScale SWORD ?
dmCopies SWORD ?
dmDefaultSource SWORD ?
dmPrintQuality SWORD ?
dmColor SWORD ?
dmDuplex SWORD ?
dmYResolution SWORD ?
dmTTOption SWORD ?
dmCollate SWORD ?
dmFormName BYTE 32 dup (?)
dmLogPixels WORD ?
dmBitsPerPel DWORD ?
dmPelsWidth DWORD ?
dmPelsHeight DWORD ?
union
dmDisplayFlags DWORD ?
dmNup DWORD ?
ends
dmDisplayFrequency DWORD ?
dmICMMethod DWORD ?
dmICMIntent DWORD ?
dmMediaType DWORD ?
dmDitherType DWORD ?
dmReserved1 DWORD ?
dmReserved2 DWORD ?
dmPanningWidth DWORD ?
dmPanningHeight DWORD ?
DEVMODEX ends
.data
msg db "%d x %d",10,0
dev db "\\.\DISPLAY1",0
dm DEVMODEX <<?>>
.code
mainCRTStartup PROC C
invoke EnumDisplaySettingsA, 0, -1, ADDR dm ; default monitor
;invoke EnumDisplaySettingsA, ADDR dev, -1, ADDR dm
invoke printf, ADDR msg, dm.dmPelsWidth, dm.dmPelsHeight
invoke exit,0
mainCRTStartup ENDP
END mainCRTStartup
The screen resolution does not matter. What matters is the DPI.
Quote from: TimoVJL on January 25, 2025, 08:08:48 PM@NoCforMe thanks for hinting this
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
int __cdecl main(void)
{
DEVMODE dm;
dm.dmSize = sizeof(dm);
EnumDisplaySettings("\\\\.\\DISPLAY1", ENUM_CURRENT_SETTINGS, &dm);
printf("%d x %d\n", dm.dmPelsWidth, dm.dmPelsHeight);
return 0;
}
I agree :thumbsup:
Good starting point together with variables for intended width and height to downscaling from 4k resolution or upscale to bigger resolution, for example use in bigger or smaller windows controls, stretchblt
Quote from: Greenhorn on January 25, 2025, 11:02:47 PMThe screen resolution does not matter. What matters is the DPI.
Thats what she said. :biggrin:
Just kidding of course.
Quote from: Greenhorn on January 25, 2025, 11:02:47 PMThe screen resolution does not matter. What matters is the DPI.
Pretty sure they are independent. Increase the DPI and the resolution stays the same.
Quote from: sinsi on January 26, 2025, 02:55:04 AMQuote from: Greenhorn on January 25, 2025, 11:02:47 PMThe screen resolution does not matter. What matters is the DPI.
Pretty sure they are independent. Increase the DPI and the resolution stays the same.
is there correlation with screen size?
Quote from: TimoVJL on January 26, 2025, 04:14:43 AMis there correlation with screen size?
In Windows, DPI is a logical measurement so physical resolution should be the same.
Some "light" reading :biggrin:
DPI and device-independent pixels (https://learn.microsoft.com/en-us/windows/win32/learnwin32/dpi-and-device-independent-pixels)
I am working on resolution and ignoring DPI for now, but another wrinkle is aspect ratio :rolleyes:
Using that I get:
What is my Screen Resolution?
My Screen Resolution is: 1210 pixels wide x 908 pixels high
My Viewport Size is: 1170 pixels wide x 769 pixels high
My Device Pixel Ratio is: 1.3229166269302368
My Display Dimensions are: 9.53" (24.20 cm) x 7.15" (18.16 cm)
My Screen Diagonal Size is: 11.91" (30.26 cm)
My Color Depth (bits per pixel) is: 24
My Pixel Depth is: 24
My Display Aspect Ratio is: 605:454
Their screen resolution is very, very close to what I got using GetSystemMetrics() (but not exact):
1210 x 908 vs 1209 x 907.
So what do you think accounts for the discrepancy? Is it my adjusting the size of things in Control Panel?
I don't even know how that works. Something to do with DPI Awareness???
Quote from: zedd151 on January 26, 2025, 12:25:54 AMQuote from: Greenhorn on January 25, 2025, 11:02:47 PMThe screen resolution does not matter. What matters is the DPI.
Thats what she said. :biggrin:
Just kidding of course.
Yes, told her my DPI is 10 inches long..., and she believed me. :skrewy: :eusa_boohoo:
Quote from: Greenhorn on January 26, 2025, 07:51:25 AMQuote from: zedd151 on January 26, 2025, 12:25:54 AMQuote from: Greenhorn on January 25, 2025, 11:02:47 PMThe screen resolution does not matter. What matters is the DPI.
Thats what she said. :biggrin:
Just kidding of course.
Yes, told her my DPI is 10 inches long..., and she believed me. :skrewy: :eusa_boohoo:
OK, since there appear to be no women withing hearing distance:
Q: Why do women make such bad carpenters?
A: Because they've been told that *this* is 6 inches.
(ba-da-BOOMP)
QuoteSex inches på svenska
My Screen Resolution is: 1920 pixels wide x 1080 pixels high
2560x1440
Regards, Biterider
Quote from: NoCforMe on January 26, 2025, 08:41:04 AMQ: Why do women make such bad carpenters?
A: Because they've been told that *this* is 6 inches.
In front of the mirror:
He: two inches more, and I'd be a king
She: two inches less, and you'd be a queen
Quote from: jj2007 on January 27, 2025, 12:19:12 AMQuote from: NoCforMe on January 26, 2025, 08:41:04 AMQ: Why do women make such bad carpenters?
A: Because they've been told that *this* is 6 inches.
In front of the mirror:
He: two inches more, and I'd be a king
She: two inches less, and you'd be a queen
Good to be king - Mel Brooks: History, of the World, Part I
Hi Timo,
Thanks for your code. Here is the zip file containing the source file and the executable built with Poasm V12.