Comment arrêter un PC

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Comment arrêter un PC

Message par brossden »

Bonjour

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

Bonne Jounée à tous
Le Soldat Inconnu
Messages : 4312
Inscription : mer. 28/janv./2004 20:58
Localisation : Clermont ferrand OU Olsztyn
Contact :

Message par Le Soldat Inconnu »

regarde sur 2dev, il y a un exemple pour arrêter le PC, le redémarrer ou fermer la session
Je ne suis pas à moitié Polonais mais ma moitié est polonaise ... Vous avez suivi ?

[Intel quad core Q9400 2.66mhz, ATI 4870, 4Go Ram, XP (x86) / 7 (x64)]
Avatar de l’utilisateur
Droopy
Messages : 1151
Inscription : lun. 19/juil./2004 22:31

Message 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 )
brossden
Messages : 833
Inscription : lun. 26/janv./2004 14:37

Message par brossden »

Bonjour

Merci à tous, pour vos réponses !
Denis

Bonne Jounée à tous
Patrick88
Messages : 1564
Inscription : mer. 21/janv./2004 18:24

Message par Patrick88 »

en retirant la prise :lol:

patrick
Répondre