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.