using System;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;

namespace ConsoleApplication1 {
    static class Program {
        [STAThread]
        static void Main(string[] args) {
            //Application.EnableVisualStyles();　　　　　　
            //Application.SetCompatibleTextRenderingDefault(false);　　　
            //Application.Run(new Form1());　
            myApplication winAppBase = new myApplication();
            winAppBase.Run(args);
        }
    }

    class myApplication :WindowsFormsApplicationBase {
        public myApplication()
            : base() {
            this.EnableVisualStyles = true;
            this.IsSingleInstance = true;
            this.MainForm = new Form();//スタートアップフォームを設定　　　　　　
            this.StartupNextInstance += new StartupNextInstanceEventHandler(myApplication_StartupNextInstance);
        }

        void myApplication_StartupNextInstance(object sender, StartupNextInstanceEventArgs e) {
            //ここに二重起動されたときの処理を書く　　　　　　
            //e.CommandLineでコマンドライン引数を取得出来る
            string cmd = "";
            foreach(string str in e.CommandLine) {
                cmd += str + Environment.NewLine;
            }
            MessageBox.Show(cmd);
        }
    }
}