Solved

Add buttons to CFileDialog

Posted on 1998-10-18
7
352 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

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 …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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