한 걸음씩..

File Dialog / Folder Dialog 본문

프로그래밍

File Dialog / Folder Dialog

smdy0426 2013. 7. 15. 10:56
반응형

CString GetFilePath(CString extension)

{

CString strPathName;

CString szFilter = _T("extension Files (*.extension)|*.extension|All Files(*.*)|*.*|");


szFilter.Replace(_T("extension"), extension);

CFileDialog dlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);


if(IDOK == dlg.DoModal())

strPathName = dlg.GetPathName();


return strPathName;

}

////////////////////////////////////////////////////////////

CString GetDirectoryPath()

{

BROWSEINFO   bi; 

LPITEMIDLIST  idl;

WCHAR m_dirName[1024]={0,};

WCHAR m_dirFolderPath[1024] = {0,};


ZeroMemory(&bi,sizeof(BROWSEINFO)); 


bi.hwndOwner   =   this->m_hWnd; 

bi.pszDisplayName =   m_dirName;

bi.lpszTitle = _T("폴더 다이얼로그 설명..");

bi.ulFlags  =  BIF_EDITBOX | 0x0040; 


idl = SHBrowseForFolder(&bi); 


if (idl) 

SHGetPathFromIDList(idl, m_dirFolderPath);


return m_dirFolderPath;

}

반응형