MFC打开文件对话框

摘自MSDN

CFileDialog dlgFile(TRUE);
CString fileName;
const int c_cMaxFiles = 100;
const int c_cbBuffSize = (c_cMaxFiles * (MAX_PATH + 1)) + 1;
dlgFile.GetOFN().lpstrFile = fileName.GetBuffer(c_cbBuffSize);
dlgFile.GetOFN().nMaxFile = c_cMaxFiles;

dlgFile.DoModal();
fileName.ReleaseBuffer();

你可能感兴趣的:(MFC打开文件对话框)