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?
AbhiJeetAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
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.
0
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;
begin
    LoggedOn := LogonUser(PWideChar(UserName), PWideChar(UserDomain), PWideChar(Password),
        LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, Token);
  end;

Open in new window


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

Open in new window

SESSIONNAME=RDP-Tcp#0

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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Citrix

From novice to tech pro — start learning today.