how to not scale your interface in Vista?
-
- User
- Posts: 16
- Joined: Fri Jul 16, 2010 3:54 pm
how to not scale your interface in Vista?
After a long search I decided to try this forum:
How do I prevent Vista from messing up my UI? e.g. buttontext / frametext etc. is scaled to the users dpi.
SetProcessDPIAware is not the solution it seems, because it does not disable scaling of fonts.
Any suggestions welcome, but keep in mind: the goal is to NOT scale the application rather than make it dpi-aware.
Henk
How do I prevent Vista from messing up my UI? e.g. buttontext / frametext etc. is scaled to the users dpi.
SetProcessDPIAware is not the solution it seems, because it does not disable scaling of fonts.
Any suggestions welcome, but keep in mind: the goal is to NOT scale the application rather than make it dpi-aware.
Henk
Re: how to not scale your interface in Vista?
People set their text that way because they can't read it otherwise. Why would you prevent them from reading the text in your program?
-
- User
- Posts: 16
- Joined: Fri Jul 16, 2010 3:54 pm
Re: how to not scale your interface in Vista?
didn't try hard enough
Solved it by reading 'LogPixels' from registry and scaling fonts accordingly before opening a window.

Solved it by reading 'LogPixels' from registry and scaling fonts accordingly before opening a window.
Code: Select all
;- get the font scaling of the system
result = RegOpenKeyEx_(#HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI",0,#KEY_READ,@keyhandle)
If result = 0
bufferSize = SizeOf(QUAD)
RegQueryValueEx_(keyhandle, "LogPixels", 0, @type, @value.q, @bufferSize)
RegCloseKey_(keyhandle)
EndIf
If value > 0
scale.d = 96 / value ; scaled as compared to default 96 dpi
Else
scale = 1 ; no value read from registry so set default scale (W98)
EndIf
F_normal = Int(scale*10)
F_medium = Int(scale*12)
F_large = Int(scale*14)
Re: how to not scale your interface in Vista?
Nederlander?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Re: how to not scale your interface in Vista?
What about:
Should work as well and you don't have to use the registry. 
Code: Select all
Debug 96.0 / GetDeviceCaps_(GetDC_(0), #LOGPIXELSX)

If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
- User
- Posts: 16
- Joined: Fri Jul 16, 2010 3:54 pm
Re: how to not scale your interface in Vista?
Yep, uit het noorden ...blueznl wrote:Nederlander?
Started with that but for some reason didn't work, so I gave up. Later I discovered I used 8 for logpixelsx instead of 88. That returns the screenresolution. Should have used the build-in constants to start with ...c4s wrote:What about:Should work as well and you don't have to use the registry.Code: Select all
Debug 96.0 / GetDeviceCaps_(GetDC_(0), #LOGPIXELSX)
And all of this just for a Vista scaling bug!
Re: how to not scale your interface in Vista?
I see no bug in Vista's scaling - or lack of it under some circumstances.
SetProcessDPIAware_() will prevent vista from crudely scaling a GUI. The only reason your fonts still get scaled is because PB uses proper typographic units in its font creation based upon the dpi setting etc. If you were to use CreateFont_() instead then you would not see this problem.
SetProcessDPIAware_() will prevent vista from crudely scaling a GUI. The only reason your fonts still get scaled is because PB uses proper typographic units in its font creation based upon the dpi setting etc. If you were to use CreateFont_() instead then you would not see this problem.
I may look like a mule, but I'm not a complete ass.
-
- User
- Posts: 16
- Joined: Fri Jul 16, 2010 3:54 pm
Re: how to not scale your interface in Vista?
"The clipped text string is due to the fact that the TextOut function is not supported by DPI virtualization and so the text is essentially double scaled. In fact, only a portion of the Win32® APIs support DPI virtualization in Windows Vista"
So the win32 API's did not get re-written comletely in Vista. MS has another article on this in which they discuss/admit this problem and show that is is solved in W7.
Try their own Office XP in Vista with dpi scaling enabled .. several dialogues are messed up.
Off Topic but related:
I don't get the whole dp-scaling thing: I buy a large dpi screen to get more information on the screen. If I use dpi-scaling to get a virtualized low resolution screen, I might as well buy a less expensive low resolution screen. Otherwise it's just a wast of money and hardware resources.
Think about it: more expensive screen, more expensive adapter, more resources used to manufacture, more energy consumption and no gain in shown resolution. What's the point?
So the win32 API's did not get re-written comletely in Vista. MS has another article on this in which they discuss/admit this problem and show that is is solved in W7.
Try their own Office XP in Vista with dpi scaling enabled .. several dialogues are messed up.
Off Topic but related:
I don't get the whole dp-scaling thing: I buy a large dpi screen to get more information on the screen. If I use dpi-scaling to get a virtualized low resolution screen, I might as well buy a less expensive low resolution screen. Otherwise it's just a wast of money and hardware resources.
Think about it: more expensive screen, more expensive adapter, more resources used to manufacture, more energy consumption and no gain in shown resolution. What's the point?
Re: how to not scale your interface in Vista?
Ah yes, I found the article to which you refer.
I guess the message is clear... don't rely on DPI-virtualization (especially under Vista!) and instead take steps to re-scale the GUI as appropriate. Not that I have followed this advice at any time... doh!!!
I guess the message is clear... don't rely on DPI-virtualization (especially under Vista!) and instead take steps to re-scale the GUI as appropriate. Not that I have followed this advice at any time... doh!!!
I may look like a mule, but I'm not a complete ass.
-
- User
- Posts: 16
- Joined: Fri Jul 16, 2010 3:54 pm
Re: how to not scale your interface in Vista?
Most of my programs are simple calculation programs, i/o for PIC/DVM/RFID/smartcards etc., just for personal use. PB is just a tool to me, and quite a good one because it allows to program loosely and quick and produce results. Never expected them not working on Vista ..
Re: how to not scale your interface in Vista?
I've just run my Pyrex designer through a couple of DPI changes on Vista and it looked absolutely fine. I turned virtualization on and off and there was very little difference. Pyrex itself does very little in the way of rescaling (although there is a little) and I expected some awful results. As I say though it looks fine, suprisingly so considering how complex the GUI is.
I really don't think it should be that difficult to build some rescaling factor into your programs. Sure the likes of VB.net probably do it all automatically... I know the old VB used dialog units for it's forms which of coure scale automatically... unsure about VB.NET though?
Can't say as it is something which overly concerns me. If a program of mine misbehaves in this regards then I'd just add some rescaling etc.
I really don't think it should be that difficult to build some rescaling factor into your programs. Sure the likes of VB.net probably do it all automatically... I know the old VB used dialog units for it's forms which of coure scale automatically... unsure about VB.NET though?
Can't say as it is something which overly concerns me. If a program of mine misbehaves in this regards then I'd just add some rescaling etc.
I may look like a mule, but I'm not a complete ass.
Re: how to not scale your interface in Vista?
http://www.purebasic.fr/english/viewtop ... 74#p310974noorderling wrote:After a long search I decided to try this forum:
How do I prevent Vista from messing up my UI? e.g. buttontext / frametext etc. is scaled to the users dpi.
SetProcessDPIAware is not the solution it seems, because it does not disable scaling of fonts.
Any suggestions welcome, but keep in mind: the goal is to NOT scale the application rather than make it dpi-aware.
Henk
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Re: how to not scale your interface in Vista?
Why do you play a game in 1920x1080 when you could just play it in 800x600?noorderling wrote:I don't get the whole dp-scaling thing: I buy a large dpi screen to get more information on the screen. If I use dpi-scaling to get a virtualized low resolution screen, I might as well buy a less expensive low resolution screen. Otherwise it's just a wast of money and hardware resources.
Think about it: more expensive screen, more expensive adapter, more resources used to manufacture, more energy consumption and no gain in shown resolution. What's the point?

The reason is pixels defining the detailes of a font or GUI (in case of vector based UI or otherwise scalable UI).
Also there are some displays with very high pixel density but otherwise small physical size, you really do not want fonts at fixed pixel sizes then as they would be un-readably tiny.
For example, I have a 1920x1080 main screen, it's only a 20inch or so. I could have gone for a um 26+inch I guess. But I wanted less pixel spacing/more pixel density.
My 1920x1080 screen is the same width as my older (now sidescreen) that is 1680x1050. That's around, what?, 14% more detail in the width compared to my old screen.
Mind you I still have the system DPI at the default currently though, although I do have two other accounts on the machine with a corrected DPI and one with a insanely 200%+ DPI for testing.
I just haven't gotten around to using the correct DPI yet on my everyday account. (I think it's only like +7% compared to the default 96 DPI which is why I've been lazy changing it, so my 1920x1080 monitor is basically a ~107 DPI monitor)
It's easy to calibrate just find "Control Panel\Appearance and Personalization\Display" and then on the left "Set Custom text size (DPI)".
Now get out a ruler. Adjust until the computer ruler and your real ruler match exactly on the size of an inch.
PS! You will also find that the text even if it's rather small will be much more readable now due to having more pixels per letter when displaying it. (less antialiasing, less dithering, better alphablending etc.)
Why Microsoft or display manufactures forget to market that important aspect of larger DPI I have no idea.
Take my monitor for example, it's approx. a 107DPI monitor, I really wish it would have told the OS that, and had the OS ask me if I'd like to not just use the native resolution but also auto-adjust the system DPI to match the displays "physical" size. (That way a image of a coin displayed at 100% original size would actually be as large as it really is for example). I've no idea if any games out there actually support different DPI's or if they all assume 96 DPI. My guess is they don't as I haven't heard of any games exposing those settings. (though some games less you fool around with V/H FOV you still get the damn fisheye effect.)