Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program : WindowsFormsApplicationBase
- {
- static Form1 mainForm = null;
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main(string[] commandline)
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Program prog = new Program();
- prog.MainForm = mainForm = new Form1();
- prog.Run(commandline);
- }
- public Program()
- {
- this.IsSingleInstance = true;
- }
- protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
- {
- base.OnStartupNextInstance(eventArgs);
- mainForm.Startup(eventArgs.CommandLine.ToArray());
- }
- }
- public void Startup(string[] commandLine)
- {
- string output = "";
- foreach (string arg in commandLine)
- output += arg + "n";
- label1.Text = output;
- }
- public Form1()
- {
- InitializeComponent();
- Startup(Environment.GetCommandLineArgs());
- }
Add Comment
Please, Sign In to add comment