Click here to Skip to main content
15,867,453 members
Articles / Desktop Programming / WTL
Article

WinZip Like Extract Dialog

Rate me:
Please Sign up or sign in to vote.
4.55/5 (7 votes)
21 Sep 2005Public Domain2 min read 36.8K   567   11   3
An attempt to create a WinZip-like Extract dialog.

Sample Image

Introduction

Not a long time ago I wrote a backup tool for my personal use and I wanted to have a WinZip-like Extract File dialog. I was looking for some solutions in the Internet, but did not find anything suitable for me. So, I decided to write it myself and I want to share this code as it seems to me it may be useful. The first thing that I understood was that it is not very simple to work with the Windows Shell, so I was looking for solutions on CodeProject. I found an excellent MFC CShellTreeCtrl example by Paolo Messina, so I ported it to WTL, and it is the base of my dialog. I used VC 7.1. This code could not be compiled on VC 6.0, as Till Krullmann's Dialog Layout library requires ATL 7.0 collection classes.

Credits

I'd like to thank Paolo Messina for his CShellTreeCtrl, without it my work would be much complicated, and Till Krullmann for his amazing Dialog Layout library, that is used for dialog resizing. I apologize that I can not personally thank all people whose code I have used in the CVxButton class, as I wrote it almost four years ago, in order to give an XP look to my application, but most of it I found in CodeProject.

Using the code

To use the code in the application, copy folders "WaitTree", "DialogLayout" and "Mtl" to your project folder and add all of the files from these folders to the project. Copy and add files "ExtractDialog.h" and "ExtractDialog.cpp" to the project, and include "ExtractDialog.h". Be sure that files "atlcoll.h", "atlstr.h" and "atlmisc.h" are included. Define _WTL_NO_CSTRING before including "atlmisc.h". Declare CExtractDialog variable wherever you want - and that's all: call the DoModal function, and you will see the dialog. After the dialog is closed, all selected settings could be retrieved.

#include "ExtractDialog.h"

BOOL foo(LPCTSTR pszInitialFolder = _T(""))
{
    CExtractDialog dlg;

    dlg.SetFolderName(pszInitialFolder);
    if(dlg.DoModal() == IDOK)
    {
        CString strWildCard;
        CString strFolder = dlg.GetFolderName();

        if(dlg.GetUseSelected())
            strWildCard = dlg.GetFilesMask();

        //Do Something..............

        return TRUE;
    }
    return FALSE;
}

Disclaimer

THIS SOFTWARE AND THE ACCOMPANYING FILES ARE DISTRIBUTED "AS IS" AND WITHOUT ANY WARRANTIES WHETHER EXPRESSED OR IMPLIED. NO RESPONSIBILITIES FOR POSSIBLE DAMAGES CAN BE TAKEN. THE USER MUST ASSUME THE ENTIRE RISK OF USING THIS SOFTWARE.

History

  • Version 1.0 - first release.

Just to say Good-Bye

Sorry for my English :)

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication


Written By
Web Developer
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralCouple things. Pin
WREY22-Sep-05 12:33
WREY22-Sep-05 12:33 
GeneralRe: Couple things. Pin
Alweit23-Sep-05 1:10
Alweit23-Sep-05 1:10 
GeneralGood Work. Pin
Pravesh Soni21-Sep-05 19:28
Pravesh Soni21-Sep-05 19:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.