MFC 获取文件夹路径以及文件路径

获取文件夹路径

CFolderPickerDialog Open;

if (Open.DoModal() == IDOK)
{
m_strFilePath = Open.GetPathName();
UpdateData(FALSE);

}


获取文件路径

CFileDialog Open(TRUE, _T("*.bmp"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Bitmap Files (*.bmp)|*.bmp|JPEG Files (*.jpg)|*.jpg|All Files (*.*)|*.*||"), NULL);
if (Open.DoModal() == IDOK)
{
m_strFilePath = Open.GetPathName();
UpdateData(FALSE);
}

你可能感兴趣的:(MFC)