Results 1 to 2 of 2

Thread: MsgBox question

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    12

    Question

    In my VB application a MsgBox is to be displayed when
    another invoked process is completed. But, this MsgBox
    is getting displayed much before the completion of the other
    process. Here's the code that handles the MsgBox -
    ---------------------------------------------------------
    Dim hProcess As Long
    Dim ProcessId As Long
    Dim exitCode As Long

    ' execute the given commandline,
    ' get back the processid
    ProcessId = Shell(cmdline, 1)

    ' Get the handle for an existing process
    hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)

    Do
    'monitor the status of the process
    Call GetExitCodeProcess(hProcess, exitCode)
    DoEvents
    Loop While exitCode = STATUS_PENDING

    ' process completed, close the handle for
    ' the process
    Call CloseHandle(hProcess)

    MsgBox("Process completed",vbOKOnly)

    ------------------------------------------------------------
    Is there anything missing in this code that would enable the MsgBox to be displayed before the process is completed.
    I could put a timer in there, but I don't want to restrict the process to a certain time limit.

    Thanks.

  2. #2
    Addicted Member
    Join Date
    Jul 1999
    Location
    St-Élie d'Orford, Quebec, Canada
    Posts
    133
    Have you tested the return code of the getexitcodeprocess to see if it worked first ?

    Have you tried to test it with STILL_ACTIVE ?

    Just asking for the kick of it, who knows...

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