使用 delphi 2009 在 vista 上创建目录/文件的 zip 文件的任何函数
我正在寻找一种用delphi 进行压缩和压缩的简单方法。我已经查看了 torry delphi 的组件:http://www.torry.net /pages.php?s=99。它们似乎都可以实现我想要的目标,但是使用它们的一些缺点是它们都没有在 delphi 2009 中运行并且非常复杂,这使得我很难将它们移植到 delphi 2009。此外,有关的文档它们很稀缺,至少对我来说是这样。我需要基本的压缩功能,而不需要使用一堆 DLL 的开销。我的任务引导我找到 FSCTL_SET_COMPRESSION,我认为这可以解决问题,但不幸的是这也不起作用。 CREATEFILE 看起来很有希望,直到我尝试它产生与 FSCTL_SET 相同的结果...我知道 Windows 上有一些有限的本机压缩功能。例如,如果右键单击文件或文件夹并选择 -> sendTo ->zipped 文件夹,巧妙地创建了一个压缩存档。我认为如果我能够从 delphi 访问该功能,这将是一个解决方案。另外一个问题是,Linux 是否有自己的本地压缩功能,可以与此类似使用?
I am looking for a simple method of zipping and compressing with delphi. I have already looked at the components at torry delphi:http://www.torry.net/pages.php?s=99. They all seem as though they would accomplish what I want however a few disadvantages to using them is that none of them run in delphi 2009 and are very complex which makes it difficult for me to port them to delphi 2009. And besides, the documentation on them is scarce, well at least to me. I need basic zipping functionality without the overhead of using a bunch of DLLs. My quest lead me to FSCTL_SET_COMPRESSION which I thought would have settled the issue but unfortunately this too did not work. CREATEFILE looked promising, until I tried it yielded the same result as FSCTL_SET... I know that there are some limited native zipping capability on windows. For instance if one right clicks a file or folder and selects -> sendTo ->zipped folder, a zipped archive is smartly created. I think if I was able to access that capability from delphi it will be a solution. On a side issue, does linux have its own native zipping functions that can be used similar to this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
TurboPower 优秀的 Abbrvia 可以在此处下载 D2009,D2010 支持正在进行中,并且已经在 svn 中提供根据他们的论坛。
Abbrvia 曾经是一个商业(售价 $$$)产品,这意味着文档相当完整。
TurboPower's excellent Abbrevia can be downloaded for D2009 here, D2010 support is underway and already available in svn according to their forum.
Abbrevia used to be a commercial (for $$$) product, which means that the documentation is quite complete.
我用Zipforge。为什么将这些移植到 D2009 时出现问题?是因为64位的原因吗?
这是一些示例代码
I use Zipforge. Why are there problems porting these to D2009? Is it because of the 64bit??
Here is some sample code
如果您可以从 Delphi“执行”COM,那么您就可以利用 Windows shell 的内置 zip 功能。它给你良好的基本能力。
在 VBScript 中,它看起来像这样:
COM 还允许您使用 DotNetZip,这是一个免费下载,可以提供密码- 加密 zip、zip64、自解压档案、unicode、跨区 zip 和其他内容。
If you can "do" COM from Delphi, then you can take advantage of the built-in zip capability of the Windows shell. It gives you good basic capability.
In VBScript it looks like this:
COM also allws you to use DotNetZip, which is a free download, that does password-encrypted zips, zip64, Self-extracting archives, unicode, spanned zips, and other things.
我个人使用 VCL Zip,它在 D2009 和 D2010 上运行得非常好。在撰写本文时,它的价格确实是 120 美元,但非常简单、灵活,最重要的是快速。
感兴趣,请查看 VCLZIP 并下载该链接
如果您对代码
:这是基本 zip 所需的全部内容,您当然可以设置压缩级别、目录结构、zip 流、解压缩流等等。
希望这能有所帮助。
关于
Personally I use VCL Zip which runs with D2009 and D2010 perfectly fine. it does cost $120 at the time of this post but is very simple, flexible and most of all FAST.
Have a look at VCLZIP and download the trail if your interested
code wise:
is all you need for a basic zip, you can of course set compression levels, directory structures, zip streams, unzip streams and much more.
Hope this is of some assistance.
RE
看一下这个开源 SynZip 单元。它的解压速度比 Delphi 附带的默认单元更快,并且会生成更小的 exe(crc 表在启动时创建)。
不需要外部 dll。适用于 Delphi 6 至 XE。 Delphi 的 Unicode 版本没有问题。全部集中在一个单元中。
我只是做了一些更改来处理 Zip 内容中的 Unicode 文件名,不仅是 Win-Ansi 字符集,还包括任何 Unicode 字符。欢迎反馈。
Take a look at this OpenSource SynZip unit. It's even faster for decompression than the default unit shipped with Delphi, and it will generate a smaller exe (crc tables are created at startup).
No external dll is needed. Works from Delphi 6 up to XE. No problem with Unicode version of Delphi. All in a single unit.
I just made some changes to handle Unicode file names inside Zip content, not only Win-Ansi charset but any Unicode chars. Feedback is welcome.