|
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace MBtn2DblClick
{
// C#
// All methods must be contained in a class.
// This class is added to the namespace containing the Form1 class.
class StartUp
{
/// <summary>
/// The main entry point for the application.
/// </summary>
// [STAThread]
public static void Main() {
Process aProcess = Process.GetCurrentProcess();
string aProcName = aProcess.ProcessName;
if (Process.GetProcessesByName(aProcName).Length > 1) {
MessageBox.Show("The application '" + aProcName + "' is allready running !!!", "Application allready running", MessageBoxButtons.OK, MessageBoxIcon.Stop);
Application.Exit();
return;
}
// Instantiate a new instance of Form1. (but do not show)
Form1 f1 = new Form1();
System.Windows.Forms.Application.Run();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.