page needs reconstruction. The original version of this page was created
in 2011. Things have changed since then...
Oh dear, same headline, so this page is (again) about different flavours of Windows or something similar. Well, indeed! When programming for MicroSoft Windows you have to be aware of the DPI.
I strongly sugest to install a VM, like VirtualBox or VMWare or whatever you prefer.
To develop software that works regardless of settings it might be a good idea to install one or more other flavours of Windows on several Virtual Machines. Then set one VM to a different dpi setting, enable large fonts on another, and run a third VM with different dpi settings and 'XP style DPI disabled'. If all those VM's have access to a shared drive with your test code, you then can check your code's behaviour in different environments.
The quick and dirty solution.
If you don't want to be bothered with the impact of changed DPI's or fonts, and you cannot be bothered reading these pages, I suggest you do the following:
Without a doubt other people can explain it better...
Here are a few examples of PureBasic 4.51 on different Windows flavours. I've commented on each flavour below the image. I've used the following code, so you can test it yourself:
; survival guide 4_17_100 dpi
WinXP using the default normal font and 96 dpi.... Yeah, I know. I'm old
fashioned using the Windows 98 look, though I prefer the word 'classic'
or 'classy' :-)
using the 'extra large font'. As you can see, only Windows GUI elements
seem to be affected. As my PureBasic test program isn't checking the font
size, and has no such thing as dynamic / resizing gadgets, text may become
so big that it won't fit inside buttons etc. This is a common problem with
the 'extra large font' setting: many programs ignore this setting, and
thus don't work well when using it.
but using 120 dpi. Look carefully. You can see all text output (on buttons
and on the image) is upscaled following the larger DPI setting (120 instead
of 96). All Windows GUI elements are upscaled, but the gadgets and windows
created by PureBasic are not. In this case we'll either have to downsize
our font, or upscale everything else.
(64 bits) using 96 dpi. By default the option 'XP style DPI' is turned
same Vista, now at 120 dpi. The behaviour is the same as Windows XP. Text
is upscaled by PureBasic, but none of the other (PureBasic) elements is
affected. Larger DPI settings are possible in Vista and things should
work like Windows 7 when going above 120 dpi or 144 dpi. However some comments
on the Internet indicate there might be some inconcistencies, though I've
not run into those myself. I suspect Vista's 'high DPI awareness' may not
be as good as the one build into Windows 7 but I just might be wrong...
as is not uncommon :-)
7 at 120 dpi, XP style DPI. Everything works just like Vista above.
7 again at 120 dpi but this time with XP style DPI turned off. As
you can see the PureBasic output is upscaled by Windows. My application
isn't doing anything different. A query to GetDeviceCaps_() tells my application
the system is still running at 96 dpi though in fact that is not the case,
as checking DesktopWidth() tells us. You could safely handle things by
assuming you're on a regular 96 dpi system, with a smaller screen... Just
don't rely on DesktopWidth().
And the final image... for now :-) Windows 7 at 144 dpi with XP style DPI turned off. More automatic upscaling, as yu can see. Again notice the difference of screen size reported by DesktopWidth() and GetSystemMetrics_().