-2

I have created a c# application and need to ensure that if it is run from two separate locations on disk a fresh instance of the program is created.

How might I go about doing this?

2
  • That happens already by default. What exactly is the problem here? Commented Jan 15, 2017 at 19:57
  • Actually, only one istance is being execute, and for me is right. If I want to execute another istance of the same application, from different path, but that have another form title, I don't know how make this Commented Jan 15, 2017 at 20:03

1 Answer 1

3

If I am understanding correctly, you want to allow multiple instances but have each instance display a different form title. If so, one possible solution would be to use Mutex to check if it is the only running instance. Instead of restricting the additional instances, have it use a new form title, like adding a [2], [3], etc. to the end. Here are some links on how to use Mutex to check if it is the only running instance.

How can I check if my program is already running?

Prevent multiple instances of a given app in .NET?

How can I prevent launching my app multiple times?

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. I thing that your link are sufficient for my request.
If you find a question that has already been answered elsewhere on Stack Overflow, you should flag it as a duplicate, instead of posting an answer with links to the other questions.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.