Fermer Windows

Fermer Windows

Messagepar Michael DELIQUE » 05 Nov 2007 à 17:57

Code : Tout sélectionner
Public Sub CloseWindows_API(wnbAction As Integer)
   
%REM
'variables API pour la fonction CloseWindows_API
Declare Function ExitWindows Lib "User32" Alias "ExitWindowsEx" (Byval dwOptions As Long, Byval dwReserved As Long) As Long
%END REM
   
   On Error Goto ErreurCloseWindows_API
   
   Select Case wnbAction
   Case 0 'Log Off
      ExitWindows 0, &HFFFFFFFF
      
   Case 1 ' Shut Down   
      ExitWindows 1, &HFFFFFFFF
      
   Case 2 ' Reboot   
      ExitWindows 2, &HFFFFFFFF
      
   End Select
   
   Exit Sub
ErreurCloseWindows_API:
   Msgbox "("+Cstr(Getthreadinfo (1))+" Call by "+Cstr(Getthreadinfo(10))+")"+Chr(10)+"Erreur " + Str(Err) + " : "+Chr(10) + Cstr(Error)+". "+Chr(10)+"Ligne N° "+Cstr(Erl),16," ERREUR !"
   Exit Sub   
End Sub
Cordialement

Michael (SMS-Phobique)
----------------------------
"La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi."
Albert EINSTEIN
Avatar de l’utilisateur
Michael DELIQUE
Administrateur
Administrateur
 
Message(s) : 12183
Inscrit(e) le : 16 Déc 2004 à 10:36
Localisation : Paris/Cergy

Retour vers API