[RESOLVED] Kill process - How to Please?
When my application is running and I want to do an update, when you press the update button, the application closes and the update begins to check, but if there is an update, and you try to update, sometimes the application is still running in the process list.
When you click on the update button this is whats happening:
Code:
Shell "Update.exe"
Unload Me
Yet the unload me doesn't unload the application, its running in the background.
Apart from the unload me, is there another command I can use to kill the application from running, and also thinking on the same line here, when a user just clicks the big red cross in the top right to kill the application, it too is still sometimes running in the process list.
Any advice would be appreciated, thank you.
Re: Kill process - How to Please?
You need to make sure that all forms are unloaded.
In addition, if you have any loops (especially those running outside of forms, such as in a module or a class), you'll have to shut those down, or the application will continue running with no forms open.
Once all functions end their processing, and all forms and classes are unloaded, the application will automatically close in VB6.
Re: Kill process - How to Please?
Form1 is the only form running, if someone opens the about box and closes the main app, the about box is still running, when the close it, the form1 restarts and appears, that is fine, but if the form1 is the only file running, how do i add a command to kill the process of form1, or more too it kill the main.exe file from the process list?
Re: Kill process - How to Please?
Can anyone assist me please?
Re: Kill process - How to Please?
Re: Kill process - How to Please?
Never use End in your Program.Just Use the unload me only.I think you can attach the project here.Some one can help YOu
Re: Kill process - How to Please?
Sorry cant attach project, project contains sensitive data.
Re: Kill process - How to Please?
in the unload event of your last form, call this leave function:
vb Code:
Public Sub Leave(Optional txtOut As String)
Dim iret As Long
'Call SaveSets
If Len(txtOut) > 0 Then
If txtOut <> "reboot" Then MsgBox txtOut, vbInformation + vbOKOnly + vbApplicationModal, "Shutting Down..."
End If
'If txtOut = "reboot" Then
' Dim rp As String
' rp = App.path & "\" & App.EXEName & ".exe"
' iret = ShellExecute(Form1.hwnd, "Open", rp, vbNullString, vbNullString, 1)
' End
'End If
Dim X As Form
For Each X In Forms
Unload X
Set X = Nothing
Next X
End
End Sub
Re: Kill process - How to Please?
If any part of the program is running - like the program that your program shelled to - you can't close your program. Parent processes can't be closed until all child processes close - and shelling creates a child process.