Shell, And not continuing until its finished
Hi Guys,
I need to run an external program from my app, and i need to wait for it to finish before continuing the processing in my app. I posted a question on this last week and i got the following code
VB Code:
processID = Shell(App.Path & "\rar a " & rarName & ".rar " & "*.*", vbHide)
If processID <> 0 Then
procHandle = OpenProcess(0, 0, processID)
If procHandle <> 0 Then
rc = WaitForSingleObject(procHandle, 100)
Do While rc <> 0
rc = WaitForSingleObject(procHandle, 100)
DoEvents
Loop
CloseHandle (procHandle)
End If
End If
Now, this code is supposed to get the processID of the shell command and wait for it to be released and then let me continue. This code works on my computer fine (Win XP), but when i run it on a Win2K machine, the program never leaves this loop.
Is there something wrong with this code, or is it something to do with having different numbers of apps running at the same time?
I need to get this to work on Win98+ quickly, so if anyone can see why this doesn't work, or has an alternative that does what i want then i'll be very greatful.
Thanx all in advance.