Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
static void Main()
{
using (var sem = new Semaphore(1, 1, "MyApplication"))
{
if (sem.WaitOne(0))
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
else
MessageBox.Show("Программа уже запущена.");
}
}
As for me, the most convenient way without semaphores and mutexes is to use the VB library.
An example is here .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question