Page 1 sur 1

Comment arrêter un PC

Publié : ven. 08/avr./2005 13:23
par brossden
Bonjour

Tout es dans le titre, comment arrêter un PC par une commande au à la fin d'un programme ?

Publié : ven. 08/avr./2005 13:28
par Le Soldat Inconnu
regarde sur 2dev, il y a un exemple pour arrêter le PC, le redémarrer ou fermer la session

Publié : ven. 08/avr./2005 21:32
par Droopy
Dans la dernière ligne met les options que tu veux ( ce code reboot le pc )

Code : Tout sélectionner

ProcedureDLL Reboot_PC() 
  #TOKEN_ADJUST_PRIVILEGES = 32 
  #TOKEN_QUERY = 8 
  #SE_PRIVILEGE_ENABLED = 2 
  #EWX_LOGOFF = 0 
  #EWX_SHUTDOWN = 1 
  #EWX_REBOOT = 2 
  #EWX_FORCE = 4 
  #EWX_POWEROFF = 8 
  Structure MyLUID 
    LowPart.l 
    HighPart.l 
    Attributes.l 
  EndStructure 
  Structure MyTOKEN 
    PrivilegeCount.l 
    LowPart.l 
    HighPart.l 
    Attributes.l 
  EndStructure 
  Global hdlProcessHandle.l 
  Global hdlTokenHandle.l 
  Global tmpLuid.MyLUID 
  Global tkp.MyTOKEN 
  Global tkpNewButIgnored.MyTOKEN 
  Global lBufferNeeded.l 
  hdlProcessHandle = GetCurrentProcess_() 
  OpenProcessToken_(hdlProcessHandle, #TOKEN_ADJUST_PRIVILEGES | #TOKEN_QUERY, @hdlTokenHandle) 
  SysName.s=""+Chr(0) 
  Name.s="SeShutdownPrivilege"+Chr(0) 
  Erg.l=LookupPrivilegeValue_(SysName, Name, @tmpLuid) 
  tmpLuid\Attributes = #SE_PRIVILEGE_ENABLED 
  tkp\PrivilegeCount = 1  
  tkp\LowPart = tmpLuid\LowPart 
  tkp\HighPart = tmpLuid\HighPart 
  tkp\Attributes = tmpLuid\Attributes 
  Erg.l = AdjustTokenPrivileges_(hdlTokenHandle,0,@tkp,SizeOf(MyTOKEN),@tkpNewButIgnored,@lBufferNeeded) 
  Erg.l = ExitWindowsEx_((#EWX_REBOOT | #EWX_FORCE), 0) 
EndProcedure 
( Ce code n'est pas de moi )

Publié : lun. 11/avr./2005 7:14
par brossden
Bonjour

Merci à tous, pour vos réponses !

Publié : mar. 12/avr./2005 13:09
par Patrick88
en retirant la prise :lol:

patrick