2018年11月29日 星期四

[c++]MFC使用dlg 指定開啟資料夾獲取路徑

// 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

沒有留言:

張貼留言

[SQL]顯示千分位與小數顯示

  CONVERT ( data_type [ ( length ) ] , expression [ , style ] ) CONVERT style參數說明 1  (expression為 money 或 smallmoney型別): 0 : 預設,保留小數位後兩位,並四捨...