How to find out that the code are running in the Desktop UI?

Find and share HowTos to various installations / configurations!
Search

Post Reply
9 posts • Page 1 of 1
philipp.wechsler
Posts: 13
Joined: Tue May 17, 2016 2:27 pm

How to find out that the code are running in the Desktop UI?

Post by philipp.wechsler »

We need to stop the system calls in the Desktop UI and need a query if the code is running under a Desktop UI.
How to find out that the code are running in the Desktop UI? Similar to isUltralight( ).

Currently I solve it like this:

Code: Select all

string user, password;
bool isDesktopUi = ( getMobileUserInfo( user, password ) == 0 );

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: How to find out that the code are running in the Desktop UI?

Post by leoknipp »

There is no dedicated function available to get the information if a Desktop UI is used.
As most of the time the Desktop UI is started on a machine which is not a WinCC OA server you can possibly compare the information for eventHost() with the local host name. If the names do not match a remote UI is started.

Best Regards
Leopold Knipp
Senior Support Specialist

philipp.wechsler
Posts: 13
Joined: Tue May 17, 2016 2:27 pm

Re: How to find out that the code are running in the Desktop UI?

Post by philipp.wechsler »

What about the client? In the client, the local host and eventHost() are also already different. Although it does not run in the Desktop UI.

Best Regards
Philipp Wechsler

gschijndel
Posts: 373
Joined: Tue Jan 15, 2019 3:12 pm

Re: How to find out that the code are running in the Desktop UI?

Post by gschijndel »

I check if the result of 'getActiveHttpServerUrl()' is not empty to determine if running in a DesktopUI.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: How to find out that the code are running in the Desktop UI?

Post by leoknipp »

Why do you want to make a difference between a normal client UI and a Desktop-UI?
A Desktop-UI is more or less the same like a normal Runtime UI with a simplified installation and a simple project administration.

Best Regards
Leopold Knipp
Senior Support Specialist

philipp.wechsler
Posts: 13
Joined: Tue May 17, 2016 2:27 pm

Re: How to find out that the code are running in the Desktop UI?

Post by philipp.wechsler »

System calls such as opening the GEDI do not work in the Desktop UI. But it works for normal client. That's the reason why we don't want to offer such functions under Desktop UI at all.

philipp.wechsler
Posts: 13
Joined: Tue May 17, 2016 2:27 pm

Re: How to find out that the code are running in the Desktop UI?

Post by philipp.wechsler »

@gschijndel yes, your solution do the same! Thanks for your reply.

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: How to find out that the code are running in the Desktop UI?

Post by leoknipp »

With the information given by the CTRL constant WINCCOA_PATH you can also determine if a Desktop UI is used as the Desktop UI is installed in a fixed path.
E.g. for WinCC OA 3.17: C:/Siemens/Automation/WinCC_OA/DesktopUI/3.17/

Best Regards
Leopold Knipp
Senior Support Specialist

philipp.wechsler
Posts: 13
Joined: Tue May 17, 2016 2:27 pm

Re: How to find out that the code are running in the Desktop UI?

Post by philipp.wechsler »

Thanks @leoknipp, with your solution it works as well.

Best Regards
Philipp Wechsler

Post Reply
9 posts • Page 1 of 1