Inter Process Communication

G

Guest

Hi
I am developing one Windows App. I want the user should run only one
instance at time of application. But i have also two variant of this Assembly
in same code which depends on some file of current application folder. I dont
want that user can run same variant at time, but user can run two separte
instance of two variant from two different folder.
For E.g
Varint.Exe is C:\A folder
Varint.Exe is in C:\B folder
If user run the Varint.exe from folder A twice it should not run. But if
user run Varint from A and then from B. He should be alllowed. Because both
version will changes its logic at runtime depending on other files present in
the application's executable folder.
What I currently do is to find out process of the same name(Variant.Exe), if
the its are different then exit second instance which user tried. Its working
but for only one case ie no same name application varint should start. Its
not working for other case ie user can run two variant at the same type.
I want to use interprocess communication for this. When first instance is
running it will keep some data into memory. When second instance tries to
load. it will first check for the existance of data, if data is present it
will not load it self.
But i dont know how to implement this logic.
Could anyone please help me out?
 
G

Guest

If I understand correctly, you want to allow multiple running instances of
variant.exe only if each is running with a different folder. In other words,
the folder is the resource whose access is to be restricted. Have
variant.exe make a mutex whose name is derived from the folder name, and
allow/disallow variant.exe to run based on the state of the mutex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top