Hi,
I have a function in my program that detects if the user is already running an instance of my app. If this is the case, I want the currently starting app to shut down.
I've tried a couple of ways of doing this, but I guess this would be the "correct" one
if (IsRunning())
{
MsgBox.Show("Don't be gready! One instance is enough! ;)");
Application.Exit();
}
However, if I try doing this (first part of my constructor) Windows is telling me the app has stopped working (Windows is checking for a solution to the problem) and I get an error event of 1001 (System.InvalidOperationException) in the event log. IsRunning() is working fine, but it seems the app doesn't like the abrupt end.
Is there any better way of doing this?
Cheers!