Search This Blog

Thursday, April 16, 2009

CFileDialog -File open dialog example

CFileDialog fileDlg(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"Text & CSV Files (*.txt,*.csv)|*.txt;*.csv|All Files(*.*)|*.*||");
int iRet = fileDlg.DoModal();
CString csFileName;
csFileName = fileDlg.GetPathName();

if(iRet == IDOK)
{
    AfxMessageBox(csFileName);
}
else
{
     AfxMessageBox("No File Selected!");
}

No comments: