Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions
CScanForFilesDlg Class Reference

#include <ScanForFilesDlg.h>

List of all members.

Public Types

enum  { IDD = IDD_SCANFORFILES }

Public Member Functions

 CScanForFilesDlg (CWnd *pParent=NULL)

Public Attributes

CString m_sFilePattern

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual void OnOK ()
afx_msg void OnSelectFile ()
afx_msg void OnSelectFolder ()

Detailed Description

Definition at line 13 of file ScanForFilesDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 21 of file ScanForFilesDlg.h.


Constructor & Destructor Documentation

Definition at line 18 of file ScanForFilesDlg.cpp.

       : CDialog(CScanForFilesDlg::IDD, pParent)
{
       //{{AFX_DATA_INIT(CScanForFilesDlg)
       m_sFilePattern = _T("");
       //}}AFX_DATA_INIT
}

Member Function Documentation

void CScanForFilesDlg::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 27 of file ScanForFilesDlg.cpp.

{
       CDialog::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CScanForFilesDlg)
       DDX_Text(pDX, IDC_FILEPATTERN, m_sFilePattern);
       //}}AFX_DATA_MAP
}
void CScanForFilesDlg::OnOK ( ) [protected, virtual]

Definition at line 46 of file ScanForFilesDlg.cpp.

{
       UpdateData();
       CDialog::OnOK();
}

Definition at line 52 of file ScanForFilesDlg.cpp.

{
       CFileDialog dlg(TRUE, NULL, _T("*.*"));
       
       if (dlg.DoModal() == IDOK)
       {
              m_sFilePattern = dlg.GetPathName();
              UpdateData(FALSE);
       }
}

Definition at line 63 of file ScanForFilesDlg.cpp.

{
       BROWSEINFO bi;
       TCHAR szFolder[MAX_PATH + 1];

       memset(szFolder, 0, sizeof(szFolder));

       memset(&bi, 0, sizeof(bi));
       bi.hwndOwner = GetSafeHwnd();
       bi.pidlRoot = NULL;
       bi.pszDisplayName = szFolder;
       bi.lpszTitle = _T("Pick a folder to scan");

       // Open the folder browser dialog
       LPITEMIDLIST pItemList = SHBrowseForFolder(&bi);
       if (pItemList)
       {
              IMalloc *pShellAllocator = NULL;
              
              SHGetMalloc(&pShellAllocator);
              if (pShellAllocator)
              {
                     char szPath[MAX_PATH + 1];

                     if (SHGetPathFromIDList(pItemList, szPath))
                     {
                            // Chop off the end path separator
                            int nPathSize = strlen(szPath);
                            if (nPathSize > 0)
                            {
                                   if (szPath[nPathSize - 1] == '\\')
                                   {
                                          szPath[nPathSize - 1] = '\0';
                                   }
                            }

                            // Form the file pattern
                            USES_CONVERSION;
                            m_sFilePattern.Format(_T("%s\\*.*"), A2T(szPath));
                            UpdateData(FALSE);
                     }

                     pShellAllocator->Free(pItemList);
                     pShellAllocator->Release();
              }

       }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 22 of file ScanForFilesDlg.h.


The documentation for this class was generated from the following files: