Board index » delphi » Launch an external program

Launch an external program

Hello everyone,
Could someone tell me,
How do you launch an external program from within Delphi?
I would like to extract a zip file and to run wzunzip zipfile.

Thanks

  lhuynh.vcf
< 1K Download
 

Re:Launch an external program


add ShellApi to your uses list

function TForm1.ExecuteFile(const FileName, Params, DefaultDir: string;
ShowCmd: Integer): THandle;
var
  zFileName, zParams, zDir: array[0..256] of Char;
begin
  Result:=ShellExecute(Application.MainForm.Handle, nil, StrPCopy(zFileName,
FileName), StrPCopy(zParams, Params), StrPCopy(zDir, DefaultDir), ShowCmd);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ExecuteFile('mywinzipfile.zip','','',SW_SHOW);
end;

Hope this helps,

Alex

Quote
Long Huynh wrote in message <36CD998A.6A253...@futuresmag.com>...
>Hello everyone,
>Could someone tell me,
>How do you launch an external program from within Delphi?
>I would like to extract a zip file and to run wzunzip zipfile.

>Thanks

Other Threads