|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Text;
using System.Diagnostics;
namespace TestApp
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class FrmMain : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblMsg;
private System.Windows.Forms.Button btnClose;
/// <summary>
///
/// </summary>
public FrmMain()
{
// Required for Windows Form Designer support
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblMsg = new System.Windows.Forms.Label();
this.btnClose = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lblMsg
//
this.lblMsg.Location = new System.Drawing.Point(40, 40);
this.lblMsg.Name = "lblMsg";
this.lblMsg.Size = new System.Drawing.Size(208, 16);
this.lblMsg.TabIndex = 2;
this.lblMsg.Text = "Single Instance Application Demo";
//
// btnClose
//
this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnClose.Location = new System.Drawing.Point(192, 104);
this.btnClose.Name = "btnClose";
this.btnClose.TabIndex = 1;
this.btnClose.Text = "Close";
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
//
// FrmMain
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(280, 141);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.lblMsg);
this.Name = "FrmMain";
this.Text = "SingleInstance";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
SingleInstance.SingleApplication.Run(new FrmMain());
//Test code for console application
//if(SingleInstance.SingleApplication.Run() == false)
//{
// return;
//}
//Write your program logic here
}
private void btnClose_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
|
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.
Working with
Oracle. Using C/C++, VC++, MFC, STL, C#, Java etc. on various platform like Windows, Unix, Macintosh etc. from last 13+ years to convert various type of requirements into running software components. My core expertise is multithreaded desktop product and large scale enterprises software development.