General information
Category:
Windows API functions
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only