Results 1 to 4 of 4

Thread: Waiting for a Shelled Program to Finish

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    25

    Waiting for a Shelled Program to Finish

    I went to this thread and used the code found at the link below but there was a compile error.

    Pausing until shell unzip has completed
    --------------------------------------------------------------------------------
    http://www.vb-world.net/tips/tip5.html

    The variable ret& is not defined. Can I just go ahead and define it?
    Is this supposed to be a long variable? Why is there an amperstamp after it?

    Public Sub ExecCmd(cmdline$)
    Dim proc As PROCESS_INFORMATION
    Dim start As STARTUPINFO

    'Initialize the STARTUPINFO structure:
    start.cb = Len(start)

    'Start the shelled application:
    ret& = CreateProcessA(0&, cmdline$, 0&, 0&, 1&, _
    NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)

    'Wait for the shelled application to finish:
    ret& = WaitForSingleObject(proc.hProcess, INFINITE)
    ret& = CloseHandle(proc.hProcess)
    End Sub


    Please Help!!!

  2. #2
    Member
    Join Date
    Nov 2000
    Posts
    48
    Open "flag.txt" For Output As #2
    Print #2, "1"
    Close #2

    Open "test.bat" For Output As #1
    command="Your command"
    Print #1, Command
    Print #1, "del flag.txt"
    Close #1

    Exists = Dir("flag.txt")
    Shell ("text.bat")
    Do While Exists <> ""
    DoEvents
    Exists = Dir("flag.txt")
    Loop

  3. #3
    Si_the_geek
    Guest
    Yes, just define it. (inside the sub)

    Dont bother with the type, it isn't particularly important (although in this case it should be long).

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Sep 2001
    Posts
    25
    Thanks!

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