Hello!
Do you now any way to limit one app to be executed one only time?
Regards
Number of simultaneous processes limit
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
AlanRank #669 · 3.6K reputationPosted Nov 14, 2008, 1:52 AM EST
Try placing the following code as the first lines in your Main() method:
using System;
using System.Diagnostics;
static class Program
{
static void Main(string[] args)
{
Process current = Process.GetCurrentProcess();
Process[] procs = Process.GetProcessesByName(current.ProcessName);
if (procs.Length > 1)
{
// silently kill this instance if another already running
return;
}
// rest of code
}
}
Juan Antonio 011 reputationPosted Nov 17, 2008, 2:06 AM EST