1

I'm using VS2017 and have made a very simple 'launcher' for various RDP settings files using a Windows Forms application. This just calls Process.Start with a direct link to a .rdp file, or alternatively just straight to mstsc.exe

The application (and RDP sessions) displays and works correctly on standard PCs. However I have run into a problem on high DPI devices such as Surface Books/pros.

The RDP client not scaling correctly is a fairly well known issue, and we have fixed this problem using the manifest/reg change method. This is confirmed working. Double clicking a .rdp config file works correctly too.

( https://www.blackforce.co.uk/2016/04/18/remote-desktop-rdp-resolution-on-a-surface-book )

My own application also displays correctly at the correct scale. However, when I launch RDP using Process.Start, RDP client is scaled badly, as it always was before the manifest fix. I've tried opening the client alone, and with a .rdp file and result is the same. I open the same .rdp file manually, not via my app, and the client is scaled correctly.

Can anyone replicate this, or advise why the mstsc manifest file is ignored when started this way? I've also tried the using ProcessStartInfo to set UseShellExecute but still the same result.

  • 1
    My crystal ball says that your Winforms app has the jitter forcing turned on so runs as a 32-bit process. So will start c:\windows\syswow64\mstsc.exe, the one you did not hack. That PreferExternalManifest hack is gawdawful btw, nothing like the damage you can do with a global solution to a localized problem. The 32-bit view of the registry key is in Wow6432Node. Remove the jitter forcing with Project > Properties > Build. – Hans Passant Oct 18 '17 at 14:19
  • Hi Hans, Can you put your comment as an answer, so I can mark it as such, since it solved my problem! Many thanks. As for the PreferExternalManifest hack - I agree, but I'm not aware of a more specific fix? Thanks again! Mark – Mark McKenna Oct 18 '17 at 14:55
  • If only I knew how to get rid of that awfulness. Do ask at superuser.com. If you're comfortable with it then just post the answer yourself. – Hans Passant Oct 18 '17 at 14:57

1 Answers1

0

Windows desktop apps, such as RDP, can specify a DPI-scaling mode ("DPI awareness mode") either through a manifest setting or via API calls during initialization. Applications will behave differently whenever the scale factor of the display that they're on changes. You can read more about this here.

I'd speculate (I haven't tried this to confirm this speculation) that the RDP process is using a manifest to declare it's DPI awareness (as Per Monitor DPI aware) and that when you're launching a process through Process.Start that the specified DPI awareness of the app is getting changed... possibly to the DPI awareness of the calling process?

I'd use System Internals Process Explorer to determine the DPI awareness of the RDP app when it runs as expected, and then compare that to the DPI awareness of the RDP app when it's launched from your app. If that is the case, look it to whether you can specify the DPI awareness of the process that you want to start in Process.Start. Another thing that you can try is to set the DPI awareness of your WinForms app to the same DPI awareness of the RDP app (per-Monitor) to see if that helps.

Also, I'm assuming that you're running on an OS > 8.1 as Per-Monitor support was introduced in 8.1.

peterfelts
  • 542
  • 5
  • 11