Board index » delphi » Running rar.exe

Running rar.exe

I'm creating a program which needs to be able to run eg. rar.exe with my
given "flags", how can this be done?
 

Re:Running rar.exe


why don't you just use rar.dll and integrate the functions directly in your
program? rar.dll is offered for free on the rarlab homepage

Re:Running rar.exe


This unit, not my own work I admit, runs application AppName with
command-line parameters Params. The calling program waits until the called
program has completed before continuing. If you don't want this
functionality then just delete the "while WaitForSingleObject" loop at the
bottom. If rar.exe isn't in the shell's path then you'll probably want to
include the full path for AppName.

unit execwait;

interface

uses
  Windows, Forms, ShellAPI; // Include SHELLAPI in this "uses" clause

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

implementation

{ Execute an external application APPNAME.
  Pass optional parameters in PARAMS, separated by spaces.
  Wait for completion of the application
  Returns FASLE if application failed.                     }
function ExecAppWait(AppName, Params: string): Boolean;
var
  // Structure containing and receiving info about application to start
  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_showminimized;
  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.

--

Cheers,

PeterV

F**k bush and the howard he rode in on. (Substitute blair for howard as
appropriate)

Quote
"kristnjov" <kristn...@telia.com> wrote in message

news:K5%Ga.15755$dP1.30156@newsc.telia.net...
Quote
> I'm creating a program which needs to be able to run eg. rar.exe with my
> given "flags", how can this be done?

Other Threads