0

I'm using the following code in an application that automatically detects when it is run whether it is running as a service or desktop application and behaves appropriately for the situation.

JclAppInst.JclAppInstances('<application descriptive label>').CheckSingleInstance;

The code is embedded into an initialization block at the bottom of a unit that contains code responsibility for acknowledging the service status and displaying key desktop information so I know this unit is included in both modes of operation. The CheckSingleInstance call works perfectly in desktop mode making sure that only one instance is run but doesn't seem to be able to detect if the application is currently running as a service.

Unfortunately I can't work out why the JclAppInstances would be affected by the difference. Both instances are running from the same folder but are operating as different users (ie service user differs from desktop user) but my understanding is different users should work.

Does anyone know whether it is possible to do this with the JclAppInstances and if so what my problem is?

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
Kanitatlan
  • 395
  • 1
  • 9
  • The processes run in different sessions. You'll need to roll your own code I suspect. Instead of creating the named mutex in the session namespace, you'll need to create it in the global namespace. And you'll have to secure it appropriately too. – David Heffernan Feb 28 '17 at 15:56

1 Answers1

0

It seems quite clear that the JclAppInstances class doesn't support the required functionality and any solution based on using this Jedi component should refer to the following StackOverflow answer instead.

one instance of app per Computer, how?

Community
  • 1
  • 1
Kanitatlan
  • 395
  • 1
  • 9