|
-
November 15th, 2011, 04:33 AM
#1
Error while calling CFileDialog
Hi.
I have used CFileDialog to get the path of the file what users select.
When I programmed in Windows XP and Visual Studio 6.0, 2008
I didn't have any problem.
However, I changed my environment to Windows 7 & Visual Studio 2010,
since then, sometimes error is occurred.
It is not always, about 1 or 2 times per 5?
My code is here.
CString csTemp;
TCHAR szFilter[] = L"CSV Files(*.csv)|*.csv|";
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_NOVALIDATE, szFilter);
if(IDOK == fileDlg.DoModal())
csTemp=fileDlg.GetPathName();
else
{
MessageBox(_T("File Open Fail"));
return;
}
When DoModal function is called. everything is stop.
cant stop debugging, no task manager, no ctrl+alt+del, just only reboot.
I changed the option "OFN_NOVALIDATE" to solve this problem...
unfortunately, it doesn't work.
if u have any good idea. plz help me.
-
November 15th, 2011, 04:46 AM
#2
Re: Error while calling CFileDialog
Code:
TCHAR szFilter[] = L"CSV Files(*.csv)|*.csv|";
Needs an extra | at the end
Code:
TCHAR szFilter[] = L"CSV Files(*.csv)|*.csv||";
Don't know if that is the problem btw...
-
November 15th, 2011, 05:26 AM
#3
Re: Error while calling CFileDialog
 Originally Posted by Skizmo
Code:
TCHAR szFilter[] = L"CSV Files(*.csv)|*.csv|";
Needs an extra | at the end
Not sure if this needed. The vertical bar is replaced by '\0'. Along with the terminating '\0' they both make "\0\0" which is a terminator for the multi-string buffer. Everything seems fine even with single '|'.
Best regards,
Igor
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|