Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Want to To change from Console mode to Windows mode at run time

Want to To change from Console mode to Windows mode at run time

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studioannouncement
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vikrantc1355
    wrote on last edited by
    #1

    Hello, I am working on a application which runs in Window Mode. I am using Visual Studio 2003 for the developement. Following Setting control the mode of application... Project Settings->Linker->System->SubSystem == Windows. My task is to add some command line functionality in it. To make it possible I changes the above mentioned property to Console. Project Settings->Linker->System->SubSystem == Console. Now I am able to add the Command Line functioanlity and it is workign fine. Only probelm I am facing is that whenever I launch the GUI application a command window also launches. this behavior is quite obvious as application is a console one. But I want to change this behavior, I do not want console window when I launch GUI and also want to keep the console functioality. Here I would like to mention that, Conasole and Window version of the applicaion is mutually exclusive of each other and can not be used at the same time. Thanks Vikrant.

    M 1 Reply Last reply
    0
    • V vikrantc1355

      Hello, I am working on a application which runs in Window Mode. I am using Visual Studio 2003 for the developement. Following Setting control the mode of application... Project Settings->Linker->System->SubSystem == Windows. My task is to add some command line functionality in it. To make it possible I changes the above mentioned property to Console. Project Settings->Linker->System->SubSystem == Console. Now I am able to add the Command Line functioanlity and it is workign fine. Only probelm I am facing is that whenever I launch the GUI application a command window also launches. this behavior is quite obvious as application is a console one. But I want to change this behavior, I do not want console window when I launch GUI and also want to keep the console functioality. Here I would like to mention that, Conasole and Window version of the applicaion is mutually exclusive of each other and can not be used at the same time. Thanks Vikrant.

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      I would tackle this by leaving the application as GUI (SubSystem==Windows) application but if you want a console instead of a main window create one with the BOOL AllocConsole(void); API and don't call CreateWindow. Any user will not be able to tell that it isn't a 'real' console app. I hope this helps :)

      Nothing is exactly what it seems but everything with seems can be unpicked.

      V 1 Reply Last reply
      0
      • M Matthew Faithfull

        I would tackle this by leaving the application as GUI (SubSystem==Windows) application but if you want a console instead of a main window create one with the BOOL AllocConsole(void); API and don't call CreateWindow. Any user will not be able to tell that it isn't a 'real' console app. I hope this helps :)

        Nothing is exactly what it seems but everything with seems can be unpicked.

        V Offline
        V Offline
        vikrantc1355
        wrote on last edited by
        #3

        Let me explain the problem... Lets say name of application is MyApp.exe. SO following is the behavior I want. On Command Prompt C:\MyApp \\This will Launch the GuiClient C:\MyApp -Help \\This will list out the all of the commands supported by command line version C:\MyApp -Command1 \\This will execute the command and show the result on console Above mentiotned functionality is working fine if I make it a console application. If I make it a Window Application user will not ba able to alunch it from Console. But After making it a console application whenever I try to launch the windows version (i.e. By Double clicking EXE) a console window is also launched. I do not want this Console window. I hope I explain the issue.

        M 1 Reply Last reply
        0
        • V vikrantc1355

          Let me explain the problem... Lets say name of application is MyApp.exe. SO following is the behavior I want. On Command Prompt C:\MyApp \\This will Launch the GuiClient C:\MyApp -Help \\This will list out the all of the commands supported by command line version C:\MyApp -Command1 \\This will execute the command and show the result on console Above mentiotned functionality is working fine if I make it a console application. If I make it a Window Application user will not ba able to alunch it from Console. But After making it a console application whenever I try to launch the windows version (i.e. By Double clicking EXE) a console window is also launched. I do not want this Console window. I hope I explain the issue.

          M Offline
          M Offline
          Matthew Faithfull
          wrote on last edited by
          #4

          OK. If you make it a Console App you get a Console and you can't stop this as far as I know. If you make it a Windows App and check the command line in WinMain then choose to call the CreateWindow GUI code for some commands and AllocConsole console code for other command lines then you have options 1, 2 & 3 covered. What I don't see is why the user won't be able to run it from the command line. Windows deals with this just fine, try opening a command prompt and typing 'notepad' and you'll see what I mean. Is there some other reason why it won't launch like not being able to find dependent dlls?

          Nothing is exactly what it seems but everything with seems can be unpicked.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups