static void Main(String[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 mf = new Form1(args); using (NotifyIcon icon = new NotifyIcon()) { icon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(Application.ExecutablePath); icon.ContextMenu = new ContextMenu(new MenuItem[] { new MenuItem("Exit", (s, e) => { Application.Exit(); }), }); icon.Visible = true; SingleInstanceAppStarter.Start(mf, StartNewInstance); icon.Visible = false; } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SingleInstanceAppStarter.Start(new fmMain(), StartNewInstance); }