Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CFileDialog question

Posted on 1998-11-20
5
Medium Priority
?
239 Views
Last Modified: 2013-11-20
In a "save as" CFileDialog the user can choose between two file types. I want the extension of the file name to to be updated when user selects another file type.
How do I do that?
0
Comment
Question by:roar
[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
  • 3
5 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1325029
Override the OnTypeChange notification, and upate the file name there
0
 

Author Comment

by:roar
ID: 1325030
Isn't it possible to make CFileDialog do it automatically?
This is a very common, so I would expect that CFileDialog could do that.

0
 

Author Comment

by:roar
ID: 1325031
If I add a OnTypeChange notification, I can update the filename in m_ofn.lpstrFile.
But the filename isn't updated in the dialog, how do I do that?
0
 

Author Comment

by:roar
ID: 1325032
Adjusted points to 200
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 800 total points
ID: 1325033
Since CFileDialog is derived from CDialog, you can use any of the methods of CDialog on a CFileDialog. The most important one is GetDlgItem(). You need to retrieve the CWnd* pointer of the edit control. In this case, the id of the edit control you want is edt1. You'll need to include <dlgs.h>

  CWnd* edt = cfd.GetDlgItem(edt1);
  if (edt)
  {
    edt->SetWindowText(newFileName);
  }
  cfd.m_ofn.lpstrFile = newFileName;

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

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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

715 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