Click here to Skip to main content
Click here to Skip to main content
Go to top

WinZip Like Extract Dialog

, 21 Sep 2005
Rate this:
Please Sign up or sign in to vote.
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 <span class="code-string">"ExtractDialog.h"
</span>
        
    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 Smile | :)

License

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

Share

About the Author

Alweit
Web Developer
Israel Israel
No Biography provided

Comments and Discussions

 
GeneralCouple things. PinmemberWREY22-Sep-05 12:33 
GeneralRe: Couple things. PinmemberAlweit23-Sep-05 1:10 
GeneralGood Work. PinmemberEntry21-Sep-05 19:28 

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 21 Sep 2005
Article Copyright 2005 by Alweit
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid