Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect citrix "application mode"?

Tags:

delphi

citrix

Forgive me for probably using the wrong term for this "application mode".

Our application has a problem during start in that it doesn't show a task bar icon until the main window is up, even though there are loading progress windows, logon-windows, etc. on screen before that.

We change the code to fix this, but unfortunately this fix, when running the app through citrix, now shows two icons, one with just the icon and no text.

Is there a way for me to detect that the application is running through citrix? I don't know the right term for this, but only the app window is brought to the users desktop, not the whole remote desktop.

If it matters, the app is written in Delphi.

like image 842
Lasse V. Karlsen Avatar asked Nov 29 '22 21:11

Lasse V. Karlsen


1 Answers

Not sure exactly how to do this in delphi, but if you can call out to the user32.dll, and call the function:

if (GetSystemMetrics(SM_REMOTESESSION) != 0)
{
   // We are in a remote session
}

This should tell you if you are running in a Citrix or Terminal Services environment. SM_REMOTESESSION is defined as:

#define SM_REMOTESESSION        0x1000

More info on the GetSystemMetrics api here: Link to msdn

Edit The following page describes how to do exactly the above in delphi. What works for Terminal Services should also work for Citrix:

Is your Delphi Application Running under Terminal Services as a Remote Session

like image 162
John Sibly Avatar answered Dec 18 '22 07:12

John Sibly