Click here to Skip to main content
15,884,298 members
Articles / Desktop Programming / ATL

SAWZip - zip file manipulation control

Rate me:
Please Sign up or sign in to vote.
4.56/5 (6 votes)
29 Aug 2001 356.6K   5.4K   58  
An ATL based control for reading and writing zip files.
/*
Date    : 02-12-2000											
Author  : Software At Work (S.A.W.)
		  Franky Braem	(frankysprog@yucom.be)				
																
License : You're free to use these files in your projects    
          please let me know if you find this usefull.
          
		  For commercial programs : please add the following 
          copyright in your info :
			"(c) SAWZip Control created by S.A.W. - Franky Braem
			     www.braem17.yucom.be (frankysprog@yucom.be)"

Updates : Check my website for updates www.braem17.yucom.be
*/

// Archive.h : Declaration of the CArchive

#ifndef __ARCHIVE_H_
#define __ARCHIVE_H_

#include "resource.h"       // main symbols
#include "FileHandle.h"

/////////////////////////////////////////////////////////////////////////////
// CArchive
class ATL_NO_VTABLE CArchive : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CArchive, &CLSID_Archive>,
	public ISupportErrorInfo,
	public IDispatchImpl<IArchive, &IID_IArchive, &LIBID_SAWZIPLib>
{
private:
	CComBSTR m_name;
	CComQIPtr<IFiles> m_files;
	CFileHandle m_archiveFile;
public:
	
	CArchive()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_ARCHIVE)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CArchive)
	COM_INTERFACE_ENTRY(IArchive)
	COM_INTERFACE_ENTRY(ISupportErrorInfo)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

// IArchive
public:
	STDMETHOD(get_Comment)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_Comment)(/*[in]*/ BSTR newVal);
	STDMETHOD(Close)();
	STDMETHOD(get_Files)(/*[out, retval]*/ IFiles **pVal);

	HRESULT FinalConstruct()
	{
		return m_files.CoCreateInstance(CLSID_Files);
	}
	void FinalRelease()
	{
		CComQIPtr<IFilesPrivate> filesPrivate(m_files);
		filesPrivate->Close();
		m_files.Release();
	}

	STDMETHOD(get_Name)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(Create)(/*[in]*/ BSTR aName);
	STDMETHOD(Open)(/*[in]*/ BSTR aName);

	// ISupportsErrorInfo
	STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
};

#endif //__ARCHIVE_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Belgium Belgium
Programmer since 1991 using C/C++/Visual Basic and Java. Playing with wxWindows at home.

Comments and Discussions