Wednesday, June 10, 2009

CTX: How detect if an application is running through Citrix?

To detect if an application is running through Citrix or Terminal Server use the .NET code below in your application.

System.Windows.Forms.SystemInformation.TerminalServerSession
True = running on TS or Citrix


To check inside on your VB6 application:

Private Declare Function GetSystemMetrics Lib "user32.dll" (ByVal nIndex As Long) As Long
Const SM_REMOTESESSION = &H1000

if GetSystemMetrics(SM_REMOTESESSION)<>0 then MsgBox "Running on Citrix/Terminal Server"

No comments: