Finding out how a service was startet?

Hello,

when I build a Windows service in xojo… is it possible to detect at startup how the service was startet…

from Windows (sc start)
or
by user (dobble click the exe file)

Thanks.

If you double Click the excutable, IT is not run as a service. Task list will show IT under the user. On the other handicap if IT is run as a service, IT will show under svchost.

You can use the args passed to determine if the Service was started by scm or by double click. Without passing any arguments you’ll see args(0) = native path to executable file. If the services was started by scm args(1) will be the service name, or else it will be the path again if double clicked.