Solved

Simple CFileDialog Question

Posted on 1997-02-27
1
312 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to calculate times for developing software? 8 65
Replacement selected text 2 58
How to know only "File created" with EventLog 3 32
Doc'in system (example?) BA 7 87
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now