Attribute VB_Name = "Module1" Option Explicit Public Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long ' Constantes pour ExitWindowsEx Public Const EWX_LOGOFF = 0 Public Const EWX_SHUTDOWN = 1 Public Const EWX_REBOOT = 2 Public Const EWX_FORCE = 4 Public Sub ExitWin(Optional Eteindre As Boolean, Optional Redemarer As Boolean, Optional Deconnecter As Boolean) If Eteindre = True Then ExitWindowsEx EWX_SHUTDOWN, 0& ElseIf Redemarer = True Then ExitWindowsEx EWX_REBOOT, 0& Else ExitWindowsEx EWX_LOGOFF, 0& End If End End Sub