Launch DOS app from VB6


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Launch DOS app from VB6

  1. #1
    Don Goyette Guest

    Launch DOS app from VB6


    How can I launch a DOS application from my VB6 application, and get access
    to the DOS application's return code in VB6?

    TIA,

    Don Goyette


  2. #2
    T. Bradley Dean Guest

    Re: Launch DOS app from VB6

    I didn't try this out before posting, but I believe this will work:

    Shell "C:\DOSAPP.EXE > APPOUTPUT.TXT"

    Then read the results of that text document.


    Don Goyette <goyette@cts.com> wrote in message
    news:394ea3d5$1@news.devx.com...
    >
    > How can I launch a DOS application from my VB6 application, and get access
    > to the DOS application's return code in VB6?
    >
    > TIA,
    >
    > Don Goyette
    >




  3. #3
    Rick Rothstein Guest

    Re: Launch DOS app from VB6

    To T. Bradley Dean
    ==================
    Your Shell statement won't work -- redirection of output (like internal DOS
    commands) require the command processor to be specified. On top of that, the
    redirection you indicate will take the program's output to the standand
    display and send it to the specified file.

    To Don Goyette
    ==================
    The only way I can think of to get the return code is to ECHO it out to a
    file from a BAT which first runs the program. Then read the file it sent its
    output to. If you have need of this value inside your program, you will have
    to make it wait for DOS process to finish.

    Rick

    T. Bradley Dean <Bradley.Dean@InfoDish.com> wrote in message
    news:394ea632@news.devx.com...
    > I didn't try this out before posting, but I believe this will work:
    >
    > Shell "C:\DOSAPP.EXE > APPOUTPUT.TXT"
    >
    > Then read the results of that text document.
    >
    >
    > Don Goyette <goyette@cts.com> wrote in message
    > news:394ea3d5$1@news.devx.com...
    > >
    > > How can I launch a DOS application from my VB6 application, and get

    access
    > > to the DOS application's return code in VB6?
    > >
    > > TIA,
    > >
    > > Don Goyette
    > >

    >
    >




  4. #4
    goyette Guest

    Re: Launch DOS app from VB6


    Thank you, Rick. I tried the redirection and indeed it did not work, as VB
    could not open the file I redirected it to -- the file just did not get created.

    So, How does one "ECHO it out to a file from a BAT"? What's ECHO and BAT?


    BTW, the return code is simply output by the DOS application to standard
    output as a line: "return code: 1" (or 2 or 3, etc.) Using T. Bradley Dean's
    suggestion made sense to me as that let me search the redirected output for
    that line. The DOS app is not mine and I cannot make any mods to it.

    TIA,

    Don Goyette

    "Rick Rothstein" <fnroth@aosi.com> wrote:
    >To T. Bradley Dean
    >==================
    >Your Shell statement won't work -- redirection of output (like internal

    DOS
    >commands) require the command processor to be specified. On top of that,

    the
    >redirection you indicate will take the program's output to the standand
    >display and send it to the specified file.
    >
    >To Don Goyette
    >==================
    >The only way I can think of to get the return code is to ECHO it out to

    a
    >file from a BAT which first runs the program. Then read the file it sent

    its
    >output to. If you have need of this value inside your program, you will

    have
    >to make it wait for DOS process to finish.
    >
    >Rick
    >
    >T. Bradley Dean <Bradley.Dean@InfoDish.com> wrote in message
    >news:394ea632@news.devx.com...
    >> I didn't try this out before posting, but I believe this will work:
    >>
    >> Shell "C:\DOSAPP.EXE > APPOUTPUT.TXT"
    >>
    >> Then read the results of that text document.
    >>
    >>
    >> Don Goyette <goyette@cts.com> wrote in message
    >> news:394ea3d5$1@news.devx.com...
    >> >
    >> > How can I launch a DOS application from my VB6 application, and get

    >access
    >> > to the DOS application's return code in VB6?
    >> >
    >> > TIA,
    >> >
    >> > Don Goyette
    >> >

    >>
    >>

    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center