News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Using AdjustWindowRect with a dialog box

Started by zedd151, March 15, 2025, 02:58:28 PM

Previous topic - Next topic

zedd151

For anyone else reading this topic,

While jj2007's post #27  does not solve this issue described here, at least it does give a (not so good) reason why it was difficult to perfectly center my dialog box on the desktop in Windows 10. In Windows 7, using the same code, the dialog box does get perfectly centered. (within a +/- 1 pixel tolerance).
Damn Microsoft, you've done it again. 

:biggrin:

Problem not solved, but at least we know why.  :smiley:
We'll just have to live with it.  :tongue:
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

sinsi

Maybe they fixed it in Windows 11?

One thing I noticed, your Windows 7 window has a border whereas the Windows 10 window doesn't seem to.

zedd151

I seriously doubt that.

Windows 10 dialog boxes have a 1 pixel wide border around the perimeter, is that what you meant? They don't have a  wide looking border as they did in Windows 7. You can still drag the edge to resize though ...

You have never examined a screenshot (zoomed in) with mspaint, or similar?  Never done any gui graphics design?   :tongue:
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

jj2007

Quote from: sinsi on March 17, 2025, 07:48:44 AMMaybe they fixed it in Windows 11?

Unlikely, because it's a feature: it creates a 5mm or so zone (seemingly) outside the window that is shaded and serves for sizing. It makes our lives more difficult, but it does actually look better than on previous Windows versions.

sinsi

Quote from: zedd151 on March 17, 2025, 03:12:38 AMProblem not solved, but at least we know why.  :smiley:
Yes, your computer is weird

Quote from: zedd151 on March 17, 2025, 03:12:38 AMWe'll just have to live with it.  :tongue:
You will, I'm fine with it (since it seems to be OK on my computer) :biggrin:

Quote from: zedd151 on March 17, 2025, 08:17:54 AMYou have never examined a screenshot (zoomed in) with mspaint, or similar?  Never done any gui graphics design?   :tongue:
How droll  :rolleyes:


zedd151

Quote from: sinsi on March 17, 2025, 08:39:05 PM
Quote from: zedd151 on March 17, 2025, 08:17:54 AMYou have never examined a screenshot (zoomed in) with mspaint, or similar?  Never done any gui graphics design?  :tongue:
How droll  :rolleyes:
To check specifically for exact placement of graphics elements, and things of that nature. And yes, to check exact placement of centered widows and dialog boxes.
I often use mspaint for such things, zooming in to 800% to see the individual pixels better. (The version from xp, of course)  :biggrin:
Naturally, I assumed that everyone did something similar from time to time.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

BTW, Zedd, you do know about using WinSpy to check on the position of windows, right?
Very useful tool. Can also be used to move/resize things dynamically on-screen to make them line up.
Assembly language programming should be fun. That's why I do it.

zedd151

¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

BugCatcher

Why not use? DS_CENTER in your resource script's STYLE declaration?

COLLEGE_GAME DIALOGEX 10,10,1000,260
FONT 12,"Sitka Text",400,255,0
STYLE 0x90800800 ;its the 800
EXSTYLE 0x00000200
BEGIN
END

zedd151

Quote from: BugCatcher on March 18, 2025, 05:30:32 AMWhy not use? DS_CENTER in your resource script's STYLE declaration?

COLLEGE_GAME DIALOGEX 10,10,1000,260
FONT 12,"Sitka Text",400,255,0
STYLE 0x90800800
EXSTYLE 0x00000200
BEGIN
END
Because where the original example was from, the dialog box client area was resized to accommodate a user chosen image file. Then re-centered to the desktop window, to accommodate the newly resized dialog box.  :smiley:

The desired client area dimensions were not always known at program startup, or when assembling the program in the first place. (A place holder width and height were equates there) but once an image was selected by the user, the dialog box is resized, and the new centering coordinates are calculated to move and resize the dialog box.
¯\_(ツ)_/¯   :azn:

'As we don't do "requests", show us your code first.'  -  hutch—

NoCforMe

Quote from: zedd151 on March 18, 2025, 05:07:11 AMNever heard of it, to be honest.
(Referring to WinSpy)

You ought to try it. Lets you click on any "object" (window) you can see on the desktop, gives you the window and client RECT values (plus lots of other useful info, like the styles the window is using), and lets you dynamically change all those values.

It might help you see out where things are ending up on your desktop, and maybe help figure out why ...

You can download it here. (Old version, but works fine.)
Assembly language programming should be fun. That's why I do it.