// Example code
CFolderPickerDialog m_dlg;
CString m_Folder;
m_dlg.m_ofn.lpstrTitle = _T("Put your title here");
m_dlg.m_ofn.lpstrInitialDir = _T("C:\\");
if (m_dlg.DoModal() == IDOK) {
m_Folder = m_dlg.GetPathName(); // Use this to get the selected folder name
// after the dialog has closed
// May need to add a '\' for usage in GUI and for later file saving,
// as there is no '\' on the returned name
m_Folder += _T("\\");
UpdateData(FALSE); // To show updated folder in GUI
// Debug
TRACE("\n%S", m_Folder);
}
// End of example
測試環境:MFC
沒有留言:
張貼留言