Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Counting all instances of a .exe running on a shared folder

I have a c# application that is on a shared folder in which I have 3 or 4 people who all run the same .exe file. I need to be able to count all instances of the running process.

So far I've tried mutex and:

Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length;

those work if I'm trying to compute the number of instances of the .exe file I have running on my machine, but this will be running on multiple machines all pointing back to the same shared executable.

I don't want to create a file that increments and decrements depending on if a user opens or closes it for that would be unreliable.

--------edit--------------

Does anybody know how Excel does it? If the 2nd person opens the file it says that it is in use and tells you who is using it Thank you for your help!!!

like image 203
Godrules500 Avatar asked Dec 06 '25 19:12

Godrules500


1 Answers

There isn't any way other than to implement some form of a licensing service or if you have privileges to the running machines.

like image 69
Daniel A. White Avatar answered Dec 09 '25 10:12

Daniel A. White