RDP

Remote desktop on high DPI screens

It’s not so uncommon that people are facing issues with some Apps on high DPI screens. Myself, I’m super happy with my Surface Book Pro – 3000 x 2000 pixels on a 13,5″ screen. Well, my first touch with those kind of issues was with Eclipse, running on SB Pro and Windows 10 Professional. To be honest, I’m not using Eclipse so active nowadays, but I was puzzled and tried to learn why Eclipse looked so odd on my fancy SB.

Whenever you are not happy, guess whom to blame – developers! Well, in case of Eclipse, we can try to find some reasons, but what about the Remote Desktop App, it’s all about Microsoft right? So what does Microsoft say: If you wanna write some awesome Win App, you should use UWP.

Apps für die universelle Windows-Plattform können auf einer Vielzahl von Geräten ausgeführt werden, unterstützen adaptive Benutzeroberflächen, natürliche Benutzereingaben, einen Store, ein Partner Center und Clouddienste.
from the official UWP page

OK, Universal Windows Platform App should be: secure ( UWP apps declare which device resources and data they access. The user must authorize that access), able to use a common API on all devices that run Windows 10, able to use device specific capabilities and adapt the UI to different device screen sizes, resolutions, and DPI… Yes, that one! It is called: Adaptive controls and input

“… UI elements respond to the size and DPI of the screen the app is running on by adjusting their layout and scale…”

Windows helps you target your UI to multiple devices with the following features:
Universal controls and layout panels help you to optimize your UI for the screen resolution of the device.For example, controls such as buttons and sliders automatically adapt to device screen size and DPI density. Layout panels help adjust the layout of content based on the size of the screen. Adaptive scaling adjusts to resolution and DPI differences across devices.

Windows-Geräte

OK, now we know that focus is on high dpi desktop application development on windows. Bunch of interesting reading there, how developers who are looking to update desktop applications to handle display scale factor (dots per inch, or DPI) changes dynamically, allowing their applications to be crisp on any display they’re rendered on, for example. Well, my RDP looks just so perfect:

The fact that App is able to use device specific capabilities and adapt the UI to different device screen sizes, resolutions, and DPI, doesn’t make me happy at all! On the contrary, I’d like exactly do disable or switch from true to false regarding DPI. In other words, I exactly don’t wanna that my RDP is DPI aware. That’s how it’s called – dpi awareness mode. Now we need to find a way to tell that to RDP. That can be done via API call or through the manifest file – an XML document that contains the info the system needs to deploy, display, or update a Windows app.

To speed up a little bit, there are some very useful blog post, like this one: https://www.blackforce.co.uk/2016/04/18/remote-desktop-rdp-resolution-on-a-surface-book where nicely presented in a few steps how to use manifest approach to tell that app what to use, or better what not to use. Here are the steps once more time:

Open Registry editor and navigate to: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide

make a new entry: PreferExternalManifest -> 1 (decimal, or doesn’t matter if will stay Hexadecimal, it’s 1 anyway)

Create a manifest file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">

<dependency>
  <dependentAssembly>
    <assemblyIdentity
      type="win32"
      name="Microsoft.Windows.Common-Controls"
      version="6.0.0.0" processorArchitecture="*"
      publicKeyToken="6595b64144ccf1df"
      language="*">
    </assemblyIdentity>
  </dependentAssembly>
</dependency>

<dependency>
  <dependentAssembly>
    <assemblyIdentity
      type="win32"
      name="Microsoft.VC90.CRT"
      version="9.0.21022.8"
      processorArchitecture="amd64"
      publicKeyToken="1fc8b3b9a1e18e3b">
    </assemblyIdentity>
  </dependentAssembly>
</dependency>

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
    <requestedPrivileges>
      <requestedExecutionLevel
        level="asInvoker"
        uiAccess="false"/>
    </requestedPrivileges>
  </security>
</trustInfo>

<asmv3:application>
  <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
    <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
  </asmv3:windowsSettings>
</asmv3:application>

</assembly>

save it as mstsc.exe.manifest and place it exactly where the RDP app (mstsc) is, C:\Windows\System32

If we test now, the RDP session looks much more readable:

Let’s make a quick test and change the section:

<asmv3:application>  <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">    <ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>  </asmv3:windowsSettings></asmv3:application>

false -> true

if we start RDP again, our External manifest will tell to the RDP App to be aware of DPI, so our session will be switched back to the “awesome” display. Well, at least will fit into the window.

There are really many nice blogs, where you can find a workaround for your current problem, but it’s always a right thing to understand what is the story behind, I hope this post at least helped a bit to learn about UWP, DPI awareness and manifest way of controlling the Apps.