Identify multiple running instances of an application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I wrote an app in .Net and I whant only 1 instance of this app open for
the user; the user open my app, do some works and try to open another
instance of my app, I whant to show a message to user to inform hmi only one
instance is permit and close the second instance after that.

I am able to do this when the user run the application on his PC whit this :

Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName)

and if I found the name of my app in the returned collection, I display the
message and close the seconde instance.

The problem now: if my application is used by Remote session on a central PC
who others users can also open my application at the same time, I would like
to let the others users open my app. The only one contrainte is one instance
by user. The code I used does not work in this scenario.

Does anyone have idea to solution this ?

Thanks a lot
Michel
 
Back
Top