폴더지정 창 열기

반응형
CString strFolderName = _T("")

    ITEMIDLIST *pildBrowse;
    char pszPathname[MAX_FOLDERNAME_SIZE];
 
    BROWSEINFO bInfo;
    memset( &bInfo, 0, sizeof(bInfo));

    bInfo.hwndOwner = GetSafeHwnd();
    bInfo.pidlRoot = NULL;
    bInfo.pszDisplayName = pszPathname;
    bInfo.lpszTitle = _T("폴더를 선택하세요");
    bInfo.ulFlags = BIF_RETURNONLYFSDIRS;

    pildBrowse = ::SHBrowseForFolder(&bInfo);
 
    if( pildBrowse != NULL )
    {
        SHGetPathFromIDList(pildBrowse, pszPathname);
        strFolderName.Format(_T("%s"), pszPathname);

 

       CFileFind FileFinder;

       strFolderName = strFolderName + _T("*.원하는확장자");
       BOOL bWorking = FileFinder.FindFile(strFolderName);

       while ( (bWorking) )
       {
           bWorking = FileFinder.FindNextFile();

           if ( FileFinder.IsDots() ) continue;         

           if ( FileFinder.IsDirectory() )
           {

              // 하위폴더까지 처리하려면 여기서 뭔가 해야겠죠?
           }

           else
           {

              // DO SOMETHING HERE! 

           }
    }


TAGS.

Comments