0

Hai All,
This is Mahesh, I want to create an application in Visual Basic 6.0 that runs in Background and is invoked when system is going to shut down. Can anyone tell me what is the event that is activated in Visual Basic6.0 when system shuts down.
Thanks in Advance
Mahesh Gupta.B

2
Contributors
1
Reply
2
Views
10 Years
Discussion Span
Last Post by Sentax
0

Hi there.

The only way I know of how to pick up on the Windows log off event is to have code in the Query_Unload of the form. See below.

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    
    'Unload modes
    '0   The user has chosen the Close command from the Control-menu box on the form.
    '1   The Unload method has been initiated from code.
    '2   Windows is logging off.
    '3   Task Manager is closing the application.
    '4   An MDI child form is closing because the MDI form is closing.
    
    Select Case UnloadMode
        
        Case 2
            'Windows is logging off.  System initiated close
            'Do your stuff here
            
        Case Else
            Debug.Print "Unload mode: " & CStr(UnloadMode)
            
    End Select
    
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.