Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Windows API to compress files/folders

820 views
Skip to first unread message

Faisal

unread,
Jul 10, 2008, 2:03:09 AM7/10/08
to
Hi,

In WinXp we can zip files by taking
right click->send to->Compressed(Zipped) folder.

Is there any windows API to do this programatically.

Faisal

unread,
Jul 10, 2008, 6:52:38 AM7/10/08
to

http://www.codeproject.com/KB/cs/compresswithwinshellapics.aspx
This link discuss about some shell API to zip/unzip files. But the
source is in C#.

if Anybody have some idea about corresponding c++ code to access this
shell API please update.

Giovanni Dicanio

unread,
Jul 10, 2008, 10:06:18 AM7/10/08
to

"Faisal" <fais...@gmail.com>

> http://www.codeproject.com/KB/cs/compresswithwinshellapics.aspx
> This link discuss about some shell API to zip/unzip files. But the
> source is in C#.
>
> if Anybody have some idea about corresponding c++ code to access this
> shell API please update.

I believe that those C# sources use some managed wrappers on Shell API,
which I think is a COM based API.

I don't know what COM interfaces should be used for that purpose, but I
think that a very good place to ask could be:

microsoft.public.platformsdk.shell

HTH,
Giovanni

Alex Blekhman

unread,
Jul 10, 2008, 11:44:13 AM7/10/08
to
"Faisal" wrote:
> http://www.codeproject.com/KB/cs/compresswithwinshellapics.aspx
> This link discuss about some shell API to zip/unzip files. But
> the source is in C#.
>
> if Anybody have some idea about corresponding c++ code to access
> this shell API please update.

The code is horrible. It tricks Windows Shell to think that the
file is a valid ZIP archive and then copies a data into it. The
author uses Shell interfaces for sole purpose to show progress
dialog. That's all. I reckon that the trick could be pulled with
`SHFileOperation' call, as well.

Don't do this. There are zillions examples on the interbet of how
to zip/unzip files. Here is the sample of a proper way to manage
ZIP files:

"Zip Utils - clean, elegant, simple, C++/Win32"
http://www.codeproject.com/KB/files/zip_utils.aspx

HTH
Alex


Faisal

unread,
Jul 11, 2008, 5:26:54 AM7/11/08
to

Thanx Alex. It is a simple, elegant implementation.
Actually, I have been frantically searching for some zip library for
last few days.

0 new messages