Lancer une app et recup son etat ?

Résolu
ELCouz Messages postés 135 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 25 juillet 2008 - 27 févr. 2008 à 08:05
ELCouz Messages postés 135 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 25 juillet 2008 - 27 févr. 2008 à 10:09
Bonjour,

Comment executer une app (Shellexecute) et informer mon app sous delphi quelle est terminer?

Je dois lancé une application console qui rar (eh oui rar.exe) certains fichiers et j'aimerais savoir quand elle se termine (quand elle se ferme)

Merci beaucoup,

Laurent

1 réponse

ELCouz Messages postés 135 Date d'inscription jeudi 22 mars 2007 Statut Membre Dernière intervention 25 juillet 2008
27 févr. 2008 à 10:09
en cherchant sur google newgroups borland delphi jai trouver ce code...

unit shell;

interface

uses
  Windows, Forms, ShellAPI;

function ExecAppWait(AppName, Params: string): Boolean ;

implementation

function ExecAppWait(AppName, Params: string): Boolean;
var
  ShellExInfo: TShellExecuteInfo;
begin
  FillChar(ShellExInfo, SizeOf(ShellExInfo), 0);
  with ShellExInfo do begin
    cbSize := SizeOf(ShellExInfo);
    fMask := see_Mask_NoCloseProcess;
    Wnd := Application.Handle;
    lpFile := PChar(AppName);
    lpParameters := PChar(Params);
    nShow := SW_SHOWNORMAL;
  end;
  Result := ShellExecuteEx(@ShellExInfo);
  if Result then
    while WaitForSingleObject(ShellExInfo.HProcess, 100) = WAIT_TIMEOUT do
    begin
      Application.ProcessMessages;
      if Application.Terminated then Break;
    end;
end;

end.

Marche #1 :D
Merci quand meme :P
3
Rejoignez-nous