boomshanker
asked on
Windows 2000 style File Dialog box
I'm just starting out with MFC and I'm wondering if there is a way to display the Win 2000 style dialog box instead of using the older style.
Here is the code I am using now:
void CSTUploadDoc::OnDataImport ()
{
TCHAR buffer[] = _T("Dat Files (*.dat)|*.dat|All Files (*.*)|*.*||");
CFileDialog dlg(TRUE, _T("dat"), _T("*dat"), OFN_FILEMUSTEXIST, buffer);
if (dlg.DoModal() == IDOK) {
try {
CStdioFile f(dlg.GetPathName(),CFile: :modeReadW rite);
LoadData(f);
}
catch (CFileException *e) {
e->ReportError();
e->Delete();
}
}
}
Any help would be greatly appreciated.
Thx.
Here is the code I am using now:
void CSTUploadDoc::OnDataImport
{
TCHAR buffer[] = _T("Dat Files (*.dat)|*.dat|All Files (*.*)|*.*||");
CFileDialog dlg(TRUE, _T("dat"), _T("*dat"), OFN_FILEMUSTEXIST, buffer);
if (dlg.DoModal() == IDOK) {
try {
CStdioFile f(dlg.GetPathName(),CFile:
LoadData(f);
}
catch (CFileException *e) {
e->ReportError();
e->Delete();
}
}
}
Any help would be greatly appreciated.
Thx.
ASKER
Thanks for your response.
Could you possibly show me how to implement that with the code I have?
If I use the code you supplied as follows:
dlg.m_ofn.lStructSize = sizeof(lStructSize)+3*size of(DWORD);
I get an "lStructSize Undeclared Identifier" error upon compile.
How do I declare lStructSize? Do I have to set any other data members of the struct?
Thank you in advance for any further help you may offer.
Could you possibly show me how to implement that with the code I have?
If I use the code you supplied as follows:
dlg.m_ofn.lStructSize = sizeof(lStructSize)+3*size
I get an "lStructSize Undeclared Identifier" error upon compile.
How do I declare lStructSize? Do I have to set any other data members of the struct?
Thank you in advance for any further help you may offer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's great!
Thank you so much for your help, and your quick response.
Much appreciated.
Thank you so much for your help, and your quick response.
Much appreciated.
To use Win2K style dialog you have to set correct CFileDialog.m_ofn.lStructS
before calling DoModal;
I assume that your project doesn`t contain defines such as
_WIN32_WINNT = 0x0500;