Switch from windows app to console app.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • merik
    New Member
    • Nov 2008
    • 2

    Switch from windows app to console app.

    Hi,

    I have a windows app that I created in C# that has a dialog. Then I wanted to create a command line app that has access to the functionality that was done for the windows app. I did this by setting the "Output Type" to Console Application. The code looks something like this:

    Code:
    if (args.Length == 0)
    {				
       Application.EnableVisualStyles();
       Application.SetCompatibleTextRenderingDefault(false);
       Application.Run(new Form1());
    }
    else
    {  
       Form1.RestoreProject(arg[0]);
    }
    Everthing works fine except for the fact that the windows app has a console window. Is there a way to either set the "Output Type" programatically or kill the console when I bring up the dialog?

    Thanks,
    Merik
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Please enclose your posted code in [CODE] [/CODE] tags (See How to Ask a Question).

    This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

    Please use [CODE] [/CODE] tags in future.

    MODERATOR

    Comment

    • merik
      New Member
      • Nov 2008
      • 2

      #3
      Switch from windows app to console app.

      Hi,

      I have a windows app that I created in C# that has a dialog. Then I wanted to create a command line app that has access to the functionality that was done for the windows app. I did this by setting the "Output Type" to Console Application. The code looks something like this:

      Code:
      Expand|Select|Wrap|Line Numbers if (args.Length == 0) 
      {                 
         Application.EnableVisualStyles(); 
         Application.SetCompatibleTextRenderingDefault(false); 
         Application.Run(new Form1()); 
      } 
      else 
      {   
         Form1.RestoreProject(arg[0]); 
      }
      Everthing works fine except for the fact that the windows app has a console window. Is there a way to either set the "Output Type" programatically or kill the console when I bring up the dialog?

      Thanks,
      Merik

      Comment

      Working...