Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 如何在TZFProcessFileFailureEvent中使用fxaIgnore_Delphi_Event Handling - Fatal编程技术网

Delphi 如何在TZFProcessFileFailureEvent中使用fxaIgnore

Delphi 如何在TZFProcessFileFailureEvent中使用fxaIgnore,delphi,event-handling,Delphi,Event Handling,如何忽略错误00033?发生此错误的原因是另一个进程正在使用该文件 可以更改事件处理程序,以便在出现错误00033时忽略该文件并跳转到下一个 type TZFProcessFileFailureEvent = procedure ( Sender: TObject; FileName: String; Operation: TZFProcessOperation; NativeError: Integer; ErrorCode: Integer; Er

如何忽略错误00033?发生此错误的原因是另一个进程正在使用该文件

可以更改事件处理程序,以便在出现错误00033时忽略该文件并跳转到下一个

type TZFProcessFileFailureEvent = procedure ( 
Sender:    TObject; 
FileName:    String; 
Operation:    TZFProcessOperation; 
NativeError:   Integer; 
ErrorCode:    Integer; 
ErrorMessage:   String; 
var Action:   TZFAction 
) of object; 

type TZFAction = (fxaRetry, fxaIgnore, fxaAbort); 

property OnProcessFileFailure: TZFProcessFileFailureEvent;
我的zip文件代码

var
  archiver : TZipForge;

begin
  // Create an instance of the TZipForge class
  archiver := TZipForge.Create(nil);
  try
  with archiver do
  begin
    // Set the name of the archive file we want to create
    FileName := 'C:\test.zip';
    // Because we create a new archive,
    // we set Mode to fmCreate
    OpenArchive(fmCreate);
    // Set base (default) directory for all archive operations
    BaseDir := 'C:\';
    // Add files to the archive by mask
    AddFiles('*.exe');
    CloseArchive();
  end;
  except
  on E: Exception do
    begin
      Writeln('Exception: ', E.Message);
      // Wait for the key to be pressed
      Readln;
    end;
  end;  
end.

您是否尝试过将这样的代码添加到
OnProcessFileFailure
处理程序中

if NativeError = 1033 then
  Action := fxaIgnore;
?

即使您没有正在使用的压缩库的可用文档,线索是TZFProcessFileFailureEvent事件的
操作
参数被声明为
var
参数。这意味着您在处理程序中对其值所做的任何更改都会传递回调用事件处理程序的代码,以便您可以向它发出信号,告知您希望它如何对发生的事件做出反应


顺便说一句,我不知道你为什么在q中包括你的image1,因为你没有问过这个问题。如果您想知道如何处理特定类型的异常,如异常处理程序中的
EFOpenError
,请在Delphi联机帮助中查找如何处理该异常。

您的两幅图像都不是必需的。在任何Delphi异常对话框中,您都可以按Ctrl+C将错误消息作为文本复制到剪贴板,然后将其粘贴到您的问题中。只有在没有其他方法证明问题时,才应使用图像。列出了避免发布图像的许多原因。谢谢,我不知道可以复制异常对话框中返回的错误。