?
Solved

Simple CFileDialog Question

Posted on 1997-02-27
1
Medium Priority
?
335 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
[X]
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
1 Comment
 
LVL 3

Accepted Solution

by:
gaohong earned 300 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

649 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