|
-
Mar 18th, 2007, 10:12 PM
#1
Thread Starter
Hyperactive Member
[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.
-
Mar 18th, 2007, 10:33 PM
#2
Fanatic Member
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.
-
Mar 18th, 2007, 10:50 PM
#3
Thread Starter
Hyperactive Member
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?
-
Mar 19th, 2007, 05:36 AM
#4
Thread Starter
Hyperactive Member
Re: Kill process - How to Please?
Can anyone assist me please?
-
Mar 19th, 2007, 05:47 AM
#5
Re: Kill process - How to Please?
_____________________________________________________________________
----If this post has helped you. Please take time to Rate it.
----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.

-
Mar 19th, 2007, 06:09 AM
#6
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
Please mark you thread resolved using the Thread Tools as shown
-
Mar 19th, 2007, 06:41 AM
#7
Thread Starter
Hyperactive Member
Re: Kill process - How to Please?
Sorry cant attach project, project contains sensitive data.
-
Mar 19th, 2007, 06:56 AM
#8
Hyperactive Member
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
-
Mar 19th, 2007, 09:35 AM
#9
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.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|