You can start it from the console application using the dos command, but if you do not change the start procedure (in Main()
) when it starts, it will load and display the main window ... If you do not want the main window to be displayed, simply recode the main procedure so that the Main()
parameter disables this option ...
Instead of this:
[STAThread] static void Main() { Application.Run(new MainForm()); }
code this:
[STAThread] static void Main(params string[] args) { if(args.length <= 1) Application.Run(new MainForm()); else if (args[1].StartsWith("C"))
Then, when you run it, add the / C switch:
C:\MyCurrentDirectory>MyWinFormsApplicationName.exe /C
source share