Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 Execute DOS program

Status
Not open for further replies.

derrick

Computer
Jun 13, 2001
40
0
0
GB
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
 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.
Back
Top