Results 1 to 9 of 9

Thread: [RESOLVED] Kill process - How to Please?

  1. #1

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Resolved [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.

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962

    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.
    Involved in: Sentience

  3. #3

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    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?

  4. #4

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Kill process - How to Please?

    Can anyone assist me please?

  5. #5
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: Kill process - How to Please?

    Try:

    Unload Me
    End
    _____________________________________________________________________

    ----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.



  6. #6
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    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

  7. #7

    Thread Starter
    Hyperactive Member jokerfool's Avatar
    Join Date
    Dec 2006
    Location
    Gold Coast, Australia
    Posts
    452

    Re: Kill process - How to Please?

    Sorry cant attach project, project contains sensitive data.

  8. #8
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    372

    Re: Kill process - How to Please?

    in the unload event of your last form, call this leave function:

    vb Code:
    1. Public Sub Leave(Optional txtOut As String)
    2.  
    3. Dim iret As Long
    4.  
    5. 'Call SaveSets
    6.  
    7.  
    8. If Len(txtOut) > 0 Then
    9.         If txtOut <> "reboot" Then MsgBox txtOut, vbInformation + vbOKOnly + vbApplicationModal, "Shutting Down..."
    10. End If
    11.  
    12.  
    13. 'If txtOut = "reboot" Then
    14. '       Dim rp As String
    15. '        rp = App.path & "\" & App.EXEName & ".exe"
    16. '        iret = ShellExecute(Form1.hwnd, "Open", rp, vbNullString, vbNullString, 1)
    17. '        End
    18. 'End If
    19.  
    20.  
    21.     Dim X As Form
    22.             For Each X In Forms
    23.                  Unload X
    24.                            Set X = Nothing
    25.                        
    26.                  Next X
    27.            
    28. End
    29. End Sub

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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
  •  



Click Here to Expand Forum to Full Width