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

x
?
Solved

remove items from CFileDialog

Posted on 1998-09-02
11
Medium Priority
?
409 Views
Last Modified: 2013-11-20
hi,
I wrote a class derived from CFileDialog. I added some
controls to the dialog ( buttons ... ):

m_ofn.Flags |= (OFN_EXPLORER | OFN_ENABLETEMPLATE);
m_ofn.lpTemplateName = MAKEINTRESOURCE( IDD_MYDLG /*my
dialog additional controls*/ );

Now I want to remove some items ( e.g. the Ok button ) from
the dialog.
How to do this?

regards nil

0
Comment
Question by:nil092297
[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
  • 5
  • 4
  • 2
11 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1321623
I do not believe that is possible using the standard CFileDialog class.  Perhaps if you derived a class from it.
0
 

Author Comment

by:nil092297
ID: 1321624
I have derived my class from CFileDialog!
Or is it possible to hide the button?
0
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1321625
But if you want to remove some items and change the overall appearance look into the m_ofn member variable (the only member variable that you can access).
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 1

Accepted Solution

by:
rlarner earned 800 total points
ID: 1321626
Each of the items in a file dialog has an ID, which you can then hide.
Check out www.codeguru.com, they have examples in the dialog section (specifically the file dialogs that only display directories)

0
 

Author Comment

by:nil092297
ID: 1321627
I tried
GetDlgItem( IDOK )->ShowWindow( SW_HIDE );
but this one chrashes because m_hWnd is NULL ...
I looked at www.codeguru.com but the classes they have, and that are derived
from CFileDialog, have all the (standard) items plus additional controls.
0
 
LVL 1

Expert Comment

by:rlarner
ID: 1321628
You have to make the call in the OnInitDone method in your derived class.  Also, call HideWindow, not GetDlgItem()->ShowWindow(), since the window exists outside of your app's space.
0
 

Author Comment

by:nil092297
ID: 1321629
There is no function called HideWindow!?
0
 
LVL 1

Expert Comment

by:rlarner
ID: 1321630
Whoops!  I mistyped.  It should be: HideControl.
try downloading:
http://www.codeguru.com/dialog/folder_dialog_source.zip
It has two files.  The folder_dialog.cpp file contains an example of hiding the IDOK control.  HideDialog is an undocumented call in CFileDialog, that sends the CDM_HIDECONTROL message (which you can lookup in help).  Also try searching your help for edt1 - it will give you the description of the controls that you can hide with CDM_HIDECONTROL.
0
 
LVL 1

Expert Comment

by:rlarner
ID: 1321631
Wow, I must be off today -- that or in a hurry.  The example above doesn't actually hide the OK button, but it does hide some of the other controls.  Just use IDOK instead of, say, edt1 (which the code does show how to hide), and it should work fine.
0
 

Author Comment

by:nil092297
ID: 1321632
Ok
works fine :)
0
 

Author Comment

by:nil092297
ID: 1321633
Ok
works fine :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

730 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