Solved

Simple CFileDialog Question

Posted on 1997-02-27
1
328 Views
Last Modified: 2013-11-20
I have a stupid question, here it goes:

     I am calling a CFileDialog dialog from another dialog, wanting it to let the user pick a file to open.  I am getting an error about the *pParentWnd arg.

     Here is roughly what I am doing:

     CFileDialog opendlg(1,NULL,NULL,0,NULL,NULL,this);
     didtheyfindone=opendlg.DoModal();

     But VC coughs up a lung on the keyword "this", saying it can't convert a const * CMyApp to CWnd *.

     What am I doing wrong?

     P.S.  A short fragment that had the right idea would help. :)

     Greg
0
Comment
Question by:Greg Austin
1 Comment
 
LVL 3

Accepted Solution

by:
gaohong earned 100 total points
ID: 1300444
Hi:

 The message is pretty clear. You are doing it from your
 CMyApp class, while the call needs a CWnd pointer.

 You need CWnd pointer in the place of this, possibly
 GetMainWindow() will do or simply give NULL.

 Hope this helps

 gaohong Xie

 CFileDialog opendlg(1,NULL,NULL,0,NULL,NULL, NULL);
                    didtheyfindone=opendlg.DoModal();

                    But VC coughs up a lung on the keyword "this", saying it
                can't convert a const * CMyApp to CWnd *.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adapt this command to show who installed 29 112
Macro to save highlighted rows as a separate file 5 46
substring method in java 1 135
Sed question 2 122
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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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