remove items from CFileDialog

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

nil092297Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
rlarnerConnect With a Mentor Commented:
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
 
thresher_sharkCommented:
I do not believe that is possible using the standard CFileDialog class.  Perhaps if you derived a class from it.
0
 
nil092297Author Commented:
I have derived my class from CFileDialog!
Or is it possible to hide the button?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
thresher_sharkCommented:
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
 
nil092297Author Commented:
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
 
rlarnerCommented:
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
 
nil092297Author Commented:
There is no function called HideWindow!?
0
 
rlarnerCommented:
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
 
rlarnerCommented:
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
 
nil092297Author Commented:
Ok
works fine :)
0
 
nil092297Author Commented:
Ok
works fine :)
0
All Courses

From novice to tech pro — start learning today.