The MASM Forum

Miscellaneous => The Orphanage => Topic started by: sinsi on January 24, 2025, 04:45:25 PM

Title: Forum members' graphics/monitor setup
Post by: sinsi on January 24, 2025, 04:45:25 PM
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:
Title: Re: Forum members' graphics/monitor setup
Post by: TimoVJL on January 24, 2025, 07:00:30 PM
It might lead to problems with dialog designers ?

Two 24 " Samsung curved FullHD monitors.

24" LED Monitor C24F390FHA with Curved Display
Title: Re: Forum members' graphics/monitor setup
Post by: zedd151 on January 25, 2025, 12:35:19 AM
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:

Title: Re: Forum members' graphics/monitor setup
Post by: jj2007 on January 25, 2025, 01:25:23 AM
1920x1080 here
Title: Re: Forum members' graphics/monitor setup
Post by: daydreamer on January 25, 2025, 02:12:35 AM
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


Title: Re: Forum members' graphics/monitor setup
Post by: fearless on January 25, 2025, 05:35:19 AM
Monitor 1 (Main)
LG 27GL850
Resolution 2560x1440 pixels
Frequency 144 Hz

Monitor 2 (Side)
LG 24EN43
Resolution 1920x1080 pixels
Frequency 60 Hz
Title: Re: Forum members' graphics/monitor setup
Post by: Greenhorn on January 25, 2025, 06:41:47 AM
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.
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 25, 2025, 07:21:52 AM
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.
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 25, 2025, 07:26:03 AM
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)
Title: Re: Forum members' graphics/monitor setup
Post by: stoo23 on January 25, 2025, 09:22:11 AM
On this HP AIO: 1920 x 1080 here as well  :smiley:
Title: Re: Forum members' graphics/monitor setup
Post by: ognil on January 25, 2025, 12:30:13 PM
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
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 25, 2025, 12:36:06 PM
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:

> 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.
Title: Re: Forum members' graphics/monitor setup
Post by: zedd151 on January 25, 2025, 03:11:08 PM
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:
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 25, 2025, 03:39:10 PM
Well, is that the answer?
I can't think what else it would be.
Aaaaaargh.
Title: Re: Forum members' graphics/monitor setup
Post by: TimoVJL on January 25, 2025, 06:46:53 PM
Using browser
What Is My Screen Resolution? (https://www.whatismyip.com/screen-resolution/)
Title: Re: Forum members' graphics/monitor setup
Post by: 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);
    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
Title: Re: Forum members' graphics/monitor setup
Post by: Greenhorn on January 25, 2025, 11:02:47 PM
The screen resolution does not matter. What matters is the DPI.
Title: Re: Forum members' graphics/monitor setup
Post by: daydreamer on January 25, 2025, 11:34:07 PM
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
Title: Re: Forum members' graphics/monitor setup
Post by: zedd151 on January 26, 2025, 12:25:54 AM
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.
Title: Re: Forum members' graphics/monitor setup
Post by: sinsi on January 26, 2025, 02:55:04 AM
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.
Title: Re: Forum members' graphics/monitor setup
Post by: TimoVJL on January 26, 2025, 04:14:43 AM
Quote from: sinsi on January 26, 2025, 02:55:04 AM
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.
is there correlation with screen size?
Title: Re: Forum members' graphics/monitor setup
Post by: sinsi on January 26, 2025, 04:33:33 AM
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:
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 26, 2025, 05:18:09 AM
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???
Title: Re: Forum members' graphics/monitor setup
Post by: Greenhorn on January 26, 2025, 07:51:25 AM
Quote from: zedd151 on January 26, 2025, 12:25:54 AM
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.

Yes, told her my DPI is 10 inches long..., and she believed me.  :skrewy:  :eusa_boohoo:
Title: Re: Forum members' graphics/monitor setup
Post by: NoCforMe on January 26, 2025, 08:41:04 AM
Quote from: Greenhorn on January 26, 2025, 07:51:25 AM
Quote from: zedd151 on January 26, 2025, 12:25:54 AM
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.

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)
Title: Re: Forum members' graphics/monitor setup
Post by: TimoVJL on January 26, 2025, 09:06:42 AM
QuoteSex inches på svenska
Title: Re: Forum members' graphics/monitor setup
Post by: Mikl__ on January 26, 2025, 11:00:07 AM
My Screen Resolution is: 1920 pixels wide x 1080 pixels high
Title: Re: Forum members' graphics/monitor setup
Post by: Biterider on January 26, 2025, 04:39:55 PM
2560x1440

Regards, Biterider
Title: Re: Forum members' graphics/monitor setup
Post by: jj2007 on January 27, 2025, 12:19:12 AM
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
Title: Re: Forum members' graphics/monitor setup
Post by: TimoVJL on January 27, 2025, 12:26:24 AM
Quote from: jj2007 on January 27, 2025, 12:19:12 AM
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
Good to be king - Mel Brooks: History, of the World, Part I
Title: Re: Forum members' graphics/monitor setup
Post by: Vortex on January 27, 2025, 05:57:57 AM
Hi Timo,

Thanks for your code. Here is the zip file containing the source file and the executable built with Poasm V12.