Results 1 to 3 of 3

Thread: kill application (process) in Vb6

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Question kill application (process) in Vb6

    Hi

    Always when close my application and after open again the application in task manager I tried code below, but no worked

    Code:
    Private Sub Form_Unload(Cancel As Integer)
        Dim objCtrl As Control
        Dim objForm As Form
    
    
        For Each objForm In Forms
            If objForm.hwnd <> Me.hwnd Then
                Unload objForm
                Set objForm = Nothing
            End If
        Next objForm
        Unload Me
    
        Exit Sub
    
    
    End Sub
    When open app show me

    Name:  APLICATIVOABERTO.jpg
Views: 216
Size:  9.6 KB

  2. #2
    Hyperactive Member gilman's Avatar
    Join Date
    Jan 2017
    Location
    Bilbao
    Posts
    273

    Re: kill application (process) in Vb6

    Te without te Unload Me, the form is unloading

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: kill application (process) in Vb6

    Seems very convoluted to me.

    Form1.frm:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Dim I As Integer
        Dim Form As Form
    
        For I = 1 To 3
            Set Form = New Form2
            Form.Caption = "Child #" & CStr(I)
            Form.Show
        Next
    End Sub
    
    Private Sub Form_Unload(Cancel As Integer)
        Dim Form As Form
    
        For Each Form In Forms
            If Not Form Is Me Then Unload Form
        Next
    End Sub
    Form2.frm:
    Code:
    Option Explicit
    
    Private Sub Form_Unload(Cancel As Integer)
        MsgBox Caption & " unloading."
    End Sub
    Works fine, lasts a long time.

Tags for this Thread

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