Detail View in FileOpen Dialog
Environment: VC5 WinNT4/Win2000 ( Should work with VC6 and other Win platforms)
I wanted to have the standard file open dialog startup in detail view by default. The code gurus showed me how to customize the file open dialog but not a single article described how to start the fileopen dialog in detail view. I saw many people had specifically asked the same question but there were no answers. So, I set myself to figure out how to do this.
You can use any of the excellent articles describing how to extend the standard fileopen dialog as a starting point. Then add a few lines of code presented below to your extended dialogs OnInitDialog() method and presto! the fileopen dialog will have the detail button ( view) activated when it is shown.
The Magic, as you can see is done by posting the WM_COMMAND message to the parent of the extended fileopen dialog ( which is really the original file open dialog) with the ID (40964) of the push button for detail view. This simulates a click of the detail button and the detail view is activated for you.
The trick is simple. But I must warn you that the id of the push button for the detail view was not documented - at least I did not find it anywhere. I used spy++ tool (comes with VC5) in message mode to discover its id. I have tested this on WinNT and Win 2000. It may not work on other platforms.
BOOL MyFileOpenDialog::OnInitDialog()
{
CFileDialog::OnInitDialog();
// heres the code to enable detail view
CWnd *parent = GetParent();
if ( parent != NULL ) {
parent->PostMessage(WM_COMMAND, 40964, NULL);
}
// thats it !!
return TRUE;
}

Comments
sort by date
Posted by darksouljedi on 06/27/2006 06:15amcan someone help me please ? i want to sort automaticaly in my fileopen dialog. which id can help me ??
ReplyMore Thumbnail View Inquiries
Posted by CamasImagingGroup on 09/07/2005 12:06amCan anyone tell me how to programatically select Thumbnail View for the FileOpen dialog? I still haven't been able to figure this out. Thanks in advance. Darwin
-
Replytest
Posted by ok1997 on 09/09/2007 05:11amyes
ReplyHow should I select a folder using CFileDialog?
Posted by Legacy on 02/08/2004 12:00amOriginally posted by: Hu Zhou
When a folder is left-clicked in a CFileDialog the folder opens. When it is right-clicked there shows a pop-up menu with an option of Select, but choosing it still opens the folder, and the DoModal() does not return.
ReplyHow should I make a selection of a folder?
Thanks.
Is there any class for common dialogues in .NET Framework?
Posted by Legacy on 09/26/2003 12:00amOriginally posted by: kali prasada raju
Replyhow do i add a CView to the file open dialog?
Posted by Legacy on 07/31/2003 12:00amOriginally posted by: Rajneesh
ReplyThumbnails view ..
Posted by Legacy on 07/16/2003 12:00amOriginally posted by: Bernie Mills
I am interested in this code however would like a default of thumbnails view.
How exactly did you get the code 40964 again?
I have tried this on VS.NET2003 and XP and it works fine.
I would obviously like to obtain the code for Thumbail view.
I have used spy before however I just can't seem to get it to give up the code for Thumbails.
Any comments would be appreciated.
Bernie
ReplyWhat's the ID for Thumbnails view
Posted by Legacy on 06/09/2003 12:00amOriginally posted by: MIchael
What's the ID for the thumbnails view.
-
ReplyAccording to Microsoft's tech support, is not possible...
Posted by franrein on 05/07/2004 09:42amto change to a specific view programmatically.
ReplyThis rocks !
Posted by Legacy on 03/11/2003 12:00amOriginally posted by: Yair Konfino
what i needed.
Replyworks great.
thanks a lot.
How to save the last setting ?
Posted by Legacy on 11/26/2002 12:00amOriginally posted by: Alex Dikopoltsev
This is very nice. In addition I would like to record the last setting of the file dialog box , so next time I open it I will set the last record parameters (ie: details/list, size, type and etc). Is it possible ?
ReplyThanX ,
Alex
The identity of ID #40964
Posted by Legacy on 10/23/2002 12:00amOriginally posted by: Mike Schrag
ReplyLoading, Please Wait ...