• Status: Solved
  • Priority: Medium
  • Security: Private
  • Views: 79
  • Last Modified:

Delphi app running through citrix/hosted environment

How can i know if an is running via a hosted environment say citrix server?

So i can run a delphi app in local machine or via citrix server. When running through citrix server the application should run straight away and while running from the local machine it should ask for login credentials.

How to do this, any clue please?
1 Solution
Sinisa VukCommented:
Found same topic on Citrix forum .... So, try to get value of call GetSystemMetrics(SM_REMOTESESSION). Depending on returned prefix - you will know where you are.
Geert GOracle dbaCommented:
that's odd ... to ask for login credentials
when you start your app on the local machine or via the remote session ... the user is already logged in

how will you verify the password ?
or is it just pro-forma ?

in some companies, you only get 3 chances to type the password correctly
after that the account gets locked ...

if you really want to verify a user and password, you can use the windows function LogonUser

UserName, UserDomain and Password need to passed to the function
  LoggedOn: Boolean;
  Token: THandle;
    LoggedOn := LogonUser(PWideChar(UserName), PWideChar(UserDomain), PWideChar(Password),

Open in new window

To identify your session, you can also use
  env := GetEnvironmentVariable('SESSIONNAME');

Open in new window


if it starts with RDP, it's remote desktop

if you logon to citrix and inside that, logon with remote desktop onto a server, it also starts with RDP
there is no real way to identify this session came via citrix and rdp
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now