OVH Cloud OVH Cloud

Get the Shutdown Event with an app

1 réponse
Avatar
JM
Hello,

I need to catch the shutdown event from a computer in a VB
App.
I search the MSDN and found the ExitWindow(Ex) but this
API realize the shutdown and don't catch the event.

Could you help me?

And so if you can give me the windows start event, I will
be very happy.

Have some nice holidays and merry christmas ;)

1 réponse

Avatar
François Picalausa
"JM" a écrit dans le message de
news:080201c3c944$2ac1aa00$
I need to catch the shutdown event from a computer in a VB



Bonjour/soir,

fr.vb, ça veut dire qu'on est dans un groupe francophone ;-)

Tu as l'événement QueryUnload d'une form qui peut t'aider. unloadMode,
lrosuq'il vaut vbAppWindows signifie que "The current Microsoft Windows
operating environment session is ending."

En ayant une feuille invisible, tu peux donc facilement récupérer cette
valeur.

Exemple:
Option Explicit

Private Sub Form_Load()
Me.Visible = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = vbAppWindows Then
MsgBox "La session est en cours de fermeture"
End If
End Sub

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com