Merci,
J'ai trouvé un code sur vbfrance. Le problème est que j'arrive seulement à fermer ma session. Je n'arrive pas à éteindre complètement mon ordi. Je ne sais pas si c'est parce que windows XP professional a une sécurité.
Voici le code:
Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Boolean
Private Const EWX_SHUTDOWN = 1, EWX_REBOOT = 2, EWX_LOGOFF = 0
Private Sub Command1_Click()
'EWX_SHUTDOWN pour quitter Windows
'EWX_REBOOT pour relancer Windows
'EWX_LOGOFF pour afficher la boite <LOGIN>
a = ExitWindowsEx(EWX_SHUTDOWN, 1)
End Sub