Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to tell when a project is running & winform
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00725484
Message ID:
00725665
Views:
9
Hi Roland,

Here is the code to determine if the same app is running.
[STAThread]
static void Main() 
{
    Process [] processes = Process.GetProcessesByName("Your program name goes 
here");

    if (processes.Length != 1)
    {
        MessageBox.Show("There is another instance of the Application, the 
current one will be closed");
        return;
    }
    else
        Application.Run(new Form1());
}
>Hi,
>
>What is the coding to determine if a compiled (Built project) is already running so that the user cannot have more than one copy running.
>
>
>Also what would the coding be to determine if a winform is already running that that the user cannot open two windows of the same form?
>
>
>Thanks
>Roland
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform