NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: rupertvz on June 12, 2024, 08:10:54 AM

Title: Desktop app or Service
Post by: rupertvz on June 12, 2024, 08:10:54 AM
Hi Guys,

Is there an easy way to determine at runtime whether a NT app is running as a desktop instance, or a Windows Service?
Title: Re: Desktop app or Service
Post by: Alberto on June 12, 2024, 09:04:20 AM
May be...

How to Know If the Exe is Running as a Service
The easiest way to know if your app is running as a service is to test System{'ss:AmService'}. This is set to true when the program is in service mode. For example;

If System{'ss:AmService'} = true
  ! in service mode
End

This approach only works if you are using Clarion 10.11975 or later.
The advantage of this approach is that the code is system-global, meaning it'll work in pre-compiled DLL's, classes with no access to global data and so on.

If you are using an older build of Clarion then we recommend either (a) upgrading, or following one of the steps described in Destroy Controls above.
Title: Re: Desktop app or Service
Post by: Jane on June 12, 2024, 11:06:13 AM
If you're using SelfService, query the AmService property.

https://www.capesoft.com/docs/SelfService/selfservice.htm#ObjectProperties
Title: Re: Desktop app or Service
Post by: rupertvz on June 14, 2024, 01:25:37 AM
Thank you Jane, Alberto ;-)