Code center > Darwinbots Program Source Code
Serios bug in vb6, or is it?
Botsareus:
I can not get the program to exit on "end" statement.
for example:
The following is at the bottom of Public Sub UpdateSim()
--- Code: ---'R E S T A R T N E X T
'Botsareus 1/31/2014 seeding
If x_restartmode = 1 Then
If SimOpts.TotRunCycle = 200 Then
FileCopy MDIForm1.MainDir & "\league\test.txt", NamefileRecursive(MDIForm1.MainDir & "\league\seeded\" & totnvegsDisplayed & ".txt")
Open App.path & "\restartmode.gset" For Output As #1
Write #1, x_restartmode
Write #1, x_filenumber
Close #1
x_end = True
shell App.path & "\Restarter.exe " & App.path & "\" & App.EXEName
MDIForm1.WindowState = 0
DoEvents
MDIForm1.Move 0, 0
End If
End If
--- End code ---
If I replace the following with "end"
--- Code: --- MDIForm1.WindowState = 0
DoEvents
MDIForm1.Move 0, 0
--- End code ---
The program will not exit no matter what I do.
Any ideas?
Botsareus:
I was thinking it is because I am calling "shell" right before "end" but maybe it is because the code was nesting from the mdiform startup subroutine.
I am going to try to move the "end" code to the seconds timer tomorrow and see if that fixes it. cross-fingers.
Numsgil:
I believe the program will block until the shell command finishes. What you want is probably something like exec from linux. On windows, your best bet is probably to do a WinAPI call. eg: create process.
Botsareus:
Oh, ok. Thank you.
Botsareus:
Damn, still does not work.
I am using:
--- Code: ---
Public Sub SuperShell(pname As String)
Dim pInfo As PROCESS_INFORMATION
Dim sInfo As STARTUPINFO
Dim sNull As String
Dim lSuccess As Long
Dim lRetValue As Long
sInfo.cb = Len(sInfo)
lSuccess = CreateProcess(sNull, _
pname, _
ByVal 0&, _
ByVal 0&, _
1&, _
NORMAL_PRIORITY_CLASS, _
ByVal 0&, _
sNull, _
sInfo, _
pInfo)
End Sub
--- End code ---
Do I need to declare anything differently?
Navigation
[0] Message Index
[#] Next page
Go to full version