-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?

ScottishTapWater
  • 3,656
  • 4
  • 38
  • 81
Gianni Giordano
  • 143
  • 1
  • 2
  • 13

1 Answers1

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?

Community
  • 1
  • 1
frostbyte
  • 430
  • 5
  • 13