×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

VB6 Execute DOS program

VB6 Execute DOS program

VB6 Execute DOS program

(OP)
I am trying to wrap VB code around a DOS program, and would like to be able to capture the output (stdout).

I can execute some of the functions of the program (Swish-E) using VB, but not all, and can not access the search results.

Any help appreciated

Cheers
Derrick

RE: VB6 Execute DOS program

Below is a example that will work in VB6. It is better to use the CreateProcess API call but that is pretty complex. I hope this works for you.

Private Sub Form_Load()
    Dim temp As String, tmp As String
    Shell "dos_program > c:\output.txt", vbHide
    MsgBox "Do not click OK until your DOS program is done."
    Open "C:\output.txt" For Input As #1
    Do While Not EOF(1)
        Input #1, tmp
        temp = temp & tmp
    Loop
    Close #1
    Kill "C:\output.txt"
    MsgBox temp
End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources