Determine if a program is running on a Remote Desktop

前端 未结 3 1608
故里飘歌
故里飘歌 2020-12-09 08:55

Is there a way my program can determine when it\'s running on a Remote Desktop (Terminal Services)?

I\'d like to enable an \"inactivity timeout\" on the program when

3条回答
  •  既然无缘
    2020-12-09 09:14

    Here's the C# managed code i use:

    /// 
    /// Indicates if we're running in a remote desktop session.
    /// If we are, then you MUST disable animations and double buffering i.e. Pay your taxes!
    /// 
    /// 
    /// 
    public static Boolean IsRemoteSession
    {
        //This is just a friendly wrapper around the built-in way
        get
        {
            return System.Windows.Forms.SystemInformation.TerminalServerSession;
        }
    }
    

提交回复
热议问题