Delphi RAR 组件请求存档密码
我想要这个 RAR 组件: http://www.philippewechsler.ch/RARComponent.php
作者:菲利普·韦克斯勒。
但我不明白如何请求密码而不是存档中的文件而是存档?
文档中写的是我不明白如何使用:
OnPasswordRequired(Sender: TObject; const HeaderPassword: Boolean;
const FileName: WideString;out NewPassword: Ansistring; out Cancel: Boolean);
如果需要密码才能继续,则会发生此事件。
HeaderPassword
:如果为 true,则需要密码才能打开存档。 否则需要密码才能处理文件。
FileName
:需要密码的文件的文件名(存档名 或存档内文件的文件名)
NewPassword
:所需的密码
取消
:如果您不知道正确的密码,请将此设置为 true
如何使用此代码?
I want to the this RAR component: http://www.philippewechsler.ch/RARComponent.php
By Philippe Wechsler.
But I don't understand how can I request a password NOT for files in an archive but for an ARCHIVE?
It is written in the documentation that I don't understand how to use:
OnPasswordRequired(Sender: TObject; const HeaderPassword: Boolean;
const FileName: WideString;out NewPassword: Ansistring; out Cancel: Boolean);
This event occurs if a password is required to continue.
HeaderPassword
: if this is true, the password is required to open the archive.
Otherwise the password is needed to process a file.
FileName
: the filename of the file that requires a password (either the archivename
or the filename of the file inside the archive)
NewPassword
: the required password
Cancel
: set this to true if you don’t know the correct password
How do I use this code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这里的问题是什么...这是一个事件处理程序,您可以像分配任何其他事件处理程序一样分配它:通过双击对象中的
OnPasswordRequired
事件检查器,或者通过代码连接它:我不知道组件名称是什么(我使用了 RARComp,但我不熟悉这个组件);将其替换为正确的内容。
OnPasswordRequired
事件肯定有一个预定义的类型(例如TPasswordRequiredEvent
或其他);再说一遍,我对这个组件不熟悉。解释一下:传递给事件处理程序的
out
参数类似于var
参数,只不过它们在由组件传递之前不必进行初始化。事实上,它们是out
,这意味着它们是输出;您需要为它们分配值。另一方面,您无法更改两个const
参数(HeaderPassword
和FileName
);它们是供您决定如何设置允许更改的两个参数的值。Sender
将是RARComp
或任何您调用的组件实例;如果需要使用TRARComponent(Sender)
或(Sender as TRARComponent)
等语法访问其他信息,可以对其进行类型转换。同样,我不知道该组件的正确类名是什么,也不知道您的实例将被命名为什么。如果 IDE 组件选项板上的组件类名是
TRARComponent
,并且您将其拖放到表单上,则它将被声明为RARComponent1: TRARComponent;
,并且您将使用名称RARComponent1
和TRARComponent(Sender)
(如果适用)。I'm not sure what the question is here... This is an event handler, and you assign it just as you would any other event handler: either by double-clicking the
OnPasswordRequired
event in the Object Inspector, or by connecting it via code:I have no idea what the component name would be (I used
RARComp
, but I'm not familiar with this component); replace it with whatever is correct. There's surely a predefined type for theOnPasswordRequired
event (likeTPasswordRequiredEvent
or something); again, I'm not familiar with the component.To explain: The
out
parameters passed to the event handler are likevar
parameters, except they don't have to be initialized before being passed by the component. The fact they areout
means they are output; you're expected to assign values to them. The twoconst
parameters (HeaderPassword
andFileName
), on the other hand, can't be changed by you; they are values for your use in deciding how to set the two parameters you are allowed to change. TheSender
will be theRARComp
or whatever your component instance is called; it can be typecast if needed to access other information using syntax likeTRARComponent(Sender)
or(Sender as TRARComponent)
.Again, I have no idea what the proper classname is for this component, or what your instance of it would be named. If the classname of the component is
TRARComponent
on the IDE's component palette, and you drop it on the form, it would be declared asRARComponent1: TRARComponent;
, and you would use the nameRARComponent1
andTRARComponent(Sender)
where appropriate.