Solved

Simple CFileDialog Question

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
deburging in oracle form 12 118
iSeries DB2 Query 2 101
VBA "SendKeys" Syntax for Multiple Keystrokes 7 133
how to use laptop or pad camera in vb.net windows application 2 127
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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