12 msdn magazine
Windows 8 introduced a new programming
model for Windows apps, based on the Windows
Runtime (WinRT), which lets users dynamically
change the size of screen elements with a PC
setting. You can see what this option looks like
in the PC settings in Figure 1. On my desk-
top, the options are Default and Larger. On my
Surface Pro, the options are Smaller and Default.
It really depends on the device, and in particular,
the vertical resolution of the attached displays.
More important, Windows Store apps receive an
event whenever this option is changed and can
thus dynamically update their rendering code
to refl ect the current scaling factor.
The desktop on Windows 8, however,
remained static. Desktop applications contin-
ued to be serviced by a system DPI setting, any
changes to which would only take eff ect aft er
the user signs out and back in again, eff ectively
forcing all applications to shut down and restart.
You can see this option, which is still available
in Windows 8.1, in Figure 2, with its more gran-
ular Smaller, Medium, Larger and Extra Large options. It reminds
me of a trip to the local coff ee shop. Here, too, the options that may
be available depend on the attached displays. My Surface Pro, for
example, only includes Smaller, Medium and Larger.
Needless to say, this split personality—like many things in
Windows 8—can be quite confusing for the developer, let alone
the user. While Windows 8.1 doesn’t really address the confusion
in any meaningful way, it does fi nally allow desktop applications
to similarly handle DPI scaling dynamically, thus the user is no
longer forced to shut everything down and bring up a new logon
session. But Windows 8.1 goes a lot further and really brings new
life to multi-monitor confi gurations.
While the window in Figure 2 looks quite similar to what was
available in Windows 8, it now sports a little checkbox that was
added in Windows 8.1. Although it’s checked in Figure 2, the
default is unchecked. The checkbox title, “Let me choose
one scaling level for all my displays,” hints at the other
capability that’s new in Windows 8.1: the ability for different
monitors to have different scaling factors. The checkbox title is
a little confusing, as clearing this checkbox still offers value for
users who only have a single monitor. In that case, it still offers
the user the option of changing the scaling factor dynamically.
Checking this option really represents a legacy or compatibility
mode for DPI behavior. So whether you have multiple
monitors—or more important, regardless of how many monitors
your users might normally use—you’re going to want to come to
grips with these new options. They’ll affect your applications
whether you like it or not. Clearing this checkbox reveals
the window in Figure 3. Again, this is now the default on
Windows 8.1.
If you think about it, there’s really no diff erence between Figure 2 and
Figure 3. Th e former uses four radio buttons and the latter uses a slider
with four possible positions. Th e only real diff erence is that changes
to the slider take eff ect immediately, or at least as soon as you hit the
Apply button. Th is is much the same experience, at least for the
user, as the scaling option for Windows Store apps. Changes to
the radio button selection, however, only take eff ect the next time
the user signs in.
Th e four possible values, for either the slider or radio buttons,
correspond to four DPI scaling factors and are illustrated in
Figure 4. As a developer, I caution you not to read too much into
the specifi c DPI values. Th ey’re meant to refl ect the resolution or
Write High-DPI Apps for Windows 8.
WINDOWS WITH C++ KENNY KERR
Figure 1 Windows 8.1 PC Setting Affecting Windows Store Apps