strange problem with CFileDialog

Posted on 2002-07-07
Last Modified: 2013-11-20
Hi all, i have a problem when using the CFileDialog..
i'm using the same lines of code in my software in quite a few places but in one and only one place it gives me an "Unhandled Exception" error everytime i run the line: dlg.DoModal()... can anyone tell me what is wrong AND how to fix it?

dlg.m_ofn.lpstrTitle = "Save Sample as JPG file";
Question by:rw8
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

shahzadakhtar earned 100 total points
ID: 7136989
When the same line of code is working at other places and failing at one particular place, then probably you should look around the above code usage. If you can post the complete function where the above call is crashing then it would be helpful.

Try passing a valid parent window pointer in the last paramter of CFileDialog (righ now it is default to NULL)


Shahzad Akhtar        Tech Lead
Mindfire Solutions
"Exceptional Off-shore software delivery"
LVL 12

Expert Comment

ID: 7137063
try add '|' at the end of filter string
also use def extension without wildcards:
that is

Author Comment

ID: 7139316
Thanks shahzadakhtar. Yes i believe the problem was from the dialog box itself. I've just created another dialog box doing the same function and it's working fine now.
Thanks very much

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question