Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Wait for cmd window to finish
Message
From
10/07/2002 05:35:00
 
 
To
10/07/2002 03:37:28
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00676931
Message ID:
00676970
Views:
31
Hi Macer

I tried getting hold of the window handle once the window is open.. here is the code, it's in visual basic, but you should be able to read it.....

the code opens the bat file, and then calls the function to check is the window is still open.

The problem occurs when I call the function loopUntilWindowIsClosed

the check seems to be too fast, and hence this function thinks the window is not open, as the function is called before the window is completely open.

Any ideas on this would be great


Regards
Steven




Function processBr1Files(lcFileToProcess)

lnReturnValue = ShellExecute(0, "open", "c:\br1loader\load_br1.bat", "data\" & lcFileToProcess & " U Y Y", "c:\br1loader\", 1)



If lnReturnValue <= 32 Then
'There was an error
Select Case r
Case SE_ERR_FNF
msg = "File not found"
Case SE_ERR_PNF
msg = "Path not found"
Case SE_ERR_ACCESSDENIED
msg = "Access denied"
Case SE_ERR_OOM
msg = "Out of memory"
Case SE_ERR_DLLNOTFOUND
msg = "DLL not found"
Case SE_ERR_SHARE
msg = "A sharing violation occurred"
Case SE_ERR_ASSOCINCOMPLETE
msg = "Incomplete or invalid file association"
Case SE_ERR_DDETIMEOUT
msg = "DDE Time out"
Case SE_ERR_DDEFAIL
msg = "DDE transaction failed"
Case SE_ERR_DDEBUSY
msg = "DDE busy"
Case SE_ERR_NOASSOC
msg = "No association for file extension"
Case ERROR_BAD_FORMAT
msg = "Invalid EXE file or error in EXE image"
Case Else
msg = "Unknown error"
End Select
lnAnswer = MsgBox(msg, 48, "File run error")
End If

Call loopUntilWindowIsClosed
MsgBox ("Staring next")

End Function


Function loopUntilWindowIsClosed()



Do While FindWindow("ConsoleWindowClass", 0&) <> 0


Loop
End Function
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform