Thread: Arc Gui (beta)
View Single Post
  #86  
Old 26-11-2016, 16:09
JRD!'s Avatar
JRD! JRD! is offline
Registered User
 
Join Date: Sep 2015
Location: Matrix
Posts: 274
Thanks: 225
Thanked 600 Times in 168 Posts
JRD! is on a distinguished road
Quote:
Originally Posted by felice2011 View Post


Use the "ControlChars.Quote" module, to use as a constant for the character control.

Quick Example..

Code:
Dim id As String
id = Application.StartupPath & "\" & "Resources\Arc.exe"

Dim Method1 As String
Method1 = String.Format("a -s; -ep1 -di -i2 -r -ed -w.\_tmp " + Method_Text.Text + " {0} {1}", _
                        ControlChars.Quote & Out_Path.Text.ToString & ControlChars.Quote & _
                        ControlChars.Quote & In_Path.Text.ToString & ControlChars.Quote)
At the end of compression when you execute the specified delegate for the removal of temporary files, also eliminates files "arc.exe" & "arc.ini" .
You try to compress the "C:\Windows", this is a place that requires an elevation of rights for some operations, some file are used by the system and protect in writing.

And in terms of deleting the files "arc.exe" and "arc.ini", do you specify the working folder (temp) in the same location where the program is located?

PS: My function for execute:

Code:
function ExecAndWait(const AFileName, AParameters: string; const ShowCmd: integer): Cardinal;
var
  ShellExecuteInfo: TShellExecuteInfoW;
begin
  Result := 0;

  FillChar(ShellExecuteInfo, SizeOf(ShellExecuteInfo), #0);
  ShellExecuteInfo.cbSize := SizeOf(TShellExecuteInfo);

  with ShellExecuteInfo do
  begin
    fMask := SEE_MASK_NOCLOSEPROCESS;
    Wnd := Application.Handle;
    lpFile := PChar(AFileName);
    lpParameters := PChar(AParameters);
    lpDirectory := PChar(ExtractFilePath(AFileName));
    nShow := ShowCmd;
  end;

  if ShellExecuteEx(@ShellExecuteInfo) then
  begin
    repeat
      while WaitForSingleObject(ShellExecuteInfo.hProcess, 0) = WAIT_TIMEOUT do
       Application.ProcessMessages;
      GetExitCodeProcess(ShellExecuteInfo.hProcess, Result);
    until
    (ExitCode <> STILL_ACTIVE) or Application.Terminated;
  end;
end;
__________________
Practice makes perfect.
Reply With Quote