Solved

Simple CFileDialog Question

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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: 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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

11 Experts available now in Live!

Get 1:1 Help Now