|
-
January 21st, 2011, 04:55 AM
#1
Exception with CFileDialog (MFC)
Hi everyone! I had the following lines of C++ code in my program
CFileDialog dialog(true);
CString strFileName=L"";
INT_PTR nResult = dialog.DoModal();
if(nResult == IDOK)
// An exception's spotted here when I made a call to function GetFolderPath()
// Debug information gives me --> dialog = {CFileDialog hWnd=0x00000000}
// What's the heck?
strFileName=dialog.GetFolderPath();
The problem is: When I execute the program on a PC running Windows XP, there always have an ugly exception which I don't know why it happened. But everything's fine when I copied it to another PC running Windows 7.
I'm desperate. Would you guy please tell me why?
-
January 21st, 2011, 11:35 AM
#2
Re: Exception with CFileDialog (MFC)
I don't see a call to 'GetFolderPath()'. This:
Code:
dialog = {CFileDialog hWnd=0x00000000}
Is perfectly fine. Once your DoModal call returns, the dialog has been destroyed, and the handle to the dialog window is set to '0'.
Incidentally, you'd probably get more responses in the
Visual C++ Programming forum, as this is not a compiler bug.
Viggy
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
|