Solved

Add buttons to CFileDialog

Posted on 1998-10-18
7
350 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

910 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

22 Experts available now in Live!

Get 1:1 Help Now