Bonjour à tous

Par CreateProcess() j'appelle SHUTDOWN.EXE... mais ça ne marche pas ...

Voici le code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Var
  StartupInfo: TStartupinfo;
  ProcessInfo: TProcessInformation;
  Retour : longbool;
  Appel, Rep : string;
 
begin
 
  Rep := 'c:\Windows\System32';
  FillChar(Startupinfo,Sizeof(TStartupinfo),0);
  Startupinfo.cb:=Sizeof(TStartupInfo);
 
  Appel := Rep + '\shutdown.exe -h';
  Retour := CreateProcess(nil,
                        PChar(Appel),
  			 nil,
                         nil,
                         false,
                         normal_priority_class,
                         nil,
  			 PChar(Rep),Startupinfo,ProcessInfo);
 
.../...
Ensuite, je teste Retour, qui est True. Mais ça ne met pas le PC en veille.

Idem pour ShellExecute.

Il y a une astuce ?

Merci