Results 1 to 4 of 4

Thread: How do i output to calling dos box from VB .exe?

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    I want to
    print "processing text file..."
    and also return an integer, so a calling batch file can see if its worked or not.

    I`ve seen scraps of code to open a dos box and handle input/output, but i want to write to the one the program was run from.

    Any ideas?

  2. #2
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    this will run a batch command...
    not sure if it helps you though


    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal opOperation As String, ByVal lpFile As String, ByVal opParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

    ' just call it like this ShellExe("Explorer")

    Public Sub ShellExe(What As String)
    On Error Resume Next
    Call ShellExecute(0&, vbNullString, What, vbNullString, vbNullString, vbNormalFocus)
    End Sub
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  3. #3
    Guest
    This will write to a batch file.

    Code:
    Open "batch.bat" For Output As #1
    Print #1, "@ECHO OFF"
    Print #1, "ECHO This is a batch file example."
    Print #1, "ECHO Hope this helped..."
    Print #1, "ECHO If you need more...just ask!
    Print #1, "ECHO I am here to help!"
    Close #1
    Hope that helps a little.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    Thanks for replying, but neither of you provided what i`m after. I`m going to have to eliminate you...

    No seriously, i dont want to run a batch command, OR create one.

    What i want is to go to the dosbox and type

    MyVbApp

    which runs my vb app, and i want my app to be able to write to the dos box, like when you type

    dir

    and you get a directory listing. At the moment i could write a vb app which writes to a file, or a window, but not to the dos box.
    I also want for my app to return a error value when i quit, so the next line in a batch file that invokes MyVbApp can see if it worked or not.

    In c, you`d just

    printf ("Hello world\n");

    to print to the dos box, and

    return 0;

    to return a value. (from a 16 bit dos compiler anyway). I just want to do this is vb. Creating a new dos box isnt the solution. I need to run my code overnight and check the results in the morning, so i dont want interactive boxes and windows etc.

    Hope this is clearer!

    Thanks,
    alex

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width