Solved

Add buttons to CFileDialog

Posted on 1998-10-18
7
348 Views
Last Modified: 2013-11-20
I want to add custom buttons to the common File Dialog.
How can I do that?
0
Comment
Question by:michali
7 Comments
 

Expert Comment

by:jbalagop
ID: 1323491
if you have the handle to the file dialog when you create the CFileDialog class (using new). just use the handle to draw into the FileDialog. Also once you have the handle, one can add more controls in it. Also, make sure you do this before you call DoModal().
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 1323492
i have a full code for that. increase points.
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1323493
jbalagop's answer isn't even close to correct. He proves his incorrectness himself--you don't get a handle to the window until you call DoModal(), and even then, the call is modal and you can't see the handle unless you sublcass from CFileDialog.

I'm not sure why you'd need more than 50 points to provide a sample; the whole process isn't even ten lines long!

The way to go is to derive your own class from CFileDialog. Before you call Create() or DoModal(), make sure you set the flags in m_ofn to use an additional template. Then, set the template name and the resource handle in m_ofn to point at the template you want to use.

See http://www.nwlink.com/~mikeblas/samples/custfile.zip for a complete sample that works in VC++ 6.0.

B ekiM

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 3

Expert Comment

by:zhongbing
ID: 1323494
1. derive your own class from CFileDialog, after that, you can just deal with it like a normal dialog.

2. use the same way just like add a button to a dialog, not by Resource editer but. you should use CButton->Create() to create it.

3. then show you dialog.


0
 
LVL 3

Expert Comment

by:zhongbing
ID: 1323495
sorry for the wrong answer, yes, it can't work.
0
 
LVL 1

Expert Comment

by:Bridge
ID: 1323496
The question was answered by me in 'Page Setup dialog customization'
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1323497
Huh?  What's wrong with my answer?  Download the sample: it works and does exactly what you asked for here.

B ekiM


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 56
sum13 challenge 24 77
zeroMAx challenge 20 76
Sed question 2 49
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 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

21 Experts available now in Live!

Get 1:1 Help Now