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. Opening terminal windows from command line app

Opening terminal windows from command line app

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 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.
  • M Offline
    M Offline
    malaugh
    wrote on last edited by
    #1

    I need to command line program that starts other command line applications in their own window. I can use spawn or ecec to run the programs but they run in the main window, not their own. I tried using ShellExecute, but I got a linker error. Does a DOS terminal window have a program name I can call using system or spawn? Any suggestions? Thanks

    R D 2 Replies Last reply
    0
    • M malaugh

      I need to command line program that starts other command line applications in their own window. I can use spawn or ecec to run the programs but they run in the main window, not their own. I tried using ShellExecute, but I got a linker error. Does a DOS terminal window have a program name I can call using system or spawn? Any suggestions? Thanks

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      malaugh wrote:

      but they run in the main window, not their own

      use CreateProcess[^]and set CREATE_NEW_CONSOLE in their process creation flag.

      M 1 Reply Last reply
      0
      • R Rajkumar R

        malaugh wrote:

        but they run in the main window, not their own

        use CreateProcess[^]and set CREATE_NEW_CONSOLE in their process creation flag.

        M Offline
        M Offline
        malaugh
        wrote on last edited by
        #3

        Thanks. FYI I found another method. If you open a cmd window and type "start myprogram.exe", the program will start in another window, so in my program I used: system("start myprogram.exe"); I will your method also and see which works best.

        1 Reply Last reply
        0
        • M malaugh

          I need to command line program that starts other command line applications in their own window. I can use spawn or ecec to run the programs but they run in the main window, not their own. I tried using ShellExecute, but I got a linker error. Does a DOS terminal window have a program name I can call using system or spawn? Any suggestions? Thanks

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          malaugh wrote:

          I tried using ShellExecute, but I got a linker error.

          Did you link with Shell32.lib? If so, what was the linker error?

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          M 1 Reply Last reply
          0
          • D David Crow

            malaugh wrote:

            I tried using ShellExecute, but I got a linker error.

            Did you link with Shell32.lib? If so, what was the linker error?

            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            M Offline
            M Offline
            malaugh
            wrote on last edited by
            #5

            My mistake, I must have coded it wrong the first time. I tried it again using: ShellExecute(0,0,"myprogram.exe",0,0,SW_SHOWNORMAL); and it worked. I sued a more complex example last time, must be something to do with the options.

            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