How do I tell if my application is running in an RDP session

Christopher Edwards picture Christopher Edwards · Nov 17, 2008 · Viewed 7.8k times · Source

I have a .net winforms app which has a few animation effects, fade ins and scroll animations etc. These work fine however if I'm in a Remote Desktop Protocol session the animations start to grate.

Can someone suggest a way of determining whether or not an app is running across an RDP session so I can turn the effects off in this case?

Answer

Arnout picture Arnout · Nov 17, 2008

Assuming you're at least on .NET Framework 2.0, there's no need to use P/Invoke: just check the value of System.Windows.Forms.SystemInformation.TerminalServerSession (MSDN).