<p>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.</p>

<p>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?</p>

Use the
GetSystemMetrics()
function in the user32.dll.  Use
PInvoke
to call it.  The following is sample code provided by the first link.  The second link tells you how to invoke it in .NET.
```
```
BOOL IsRemoteSession(void){
      return GetSystemMetrics( SM_REMOTESESSION );
   }
```
```
Complete code:
```
```
[DllImport("User32.dll")]
static extern Boolean IsRemoteSession()
{
 return GetSystemMetrics ( SM_REMOTESESSION);
}
```
```
There's also the
```
SystemInformation.TerminalServerSession
```
Property, which determines whether or not the client is connected to a Terminal Server session.  The
code provided
by MSDN is extensive, so I won't duplicate it here.