|
|
|
date: Sat, 24 May 2008 16:27:00 -0700,
group: microsoft.public.platformsdk.shell
back
OPENFILENAME, modify defaults
To Jim barry.
Hi Jim,
I have been struggling with Paul DiLascia's March 2004 C++ Q&A article for
more information and some example code, as you suggested on march 13, 2008:
I am not familiar enogh with MFC to make it work
Is there an equivalent way to accomplish this wit API approah?
#include <commdlg.h>
OPENFILENAME structure
GetOpenFileName (&ofn)
Specifically, I can not translate code below into C++ code
CWnd* pshell = GetParent()->GetDlgItem(lst2);
if (pshell) {
// SHELLDLL_DefView window found: send it the command.
pshell->SendMessage(WM_COMMAND, 0x702d);
return TRUE;
}
Would you help me to translate this in C++ form ?
I wonder if there is a way to access something like WM_INITDIALOG in API
approach.
Thank you, Jim
Chang
I am listing essence of DiLucca' code,
BOOL CMyOpenDlg::OnInitDialog()
{
CFileDialog::OnInitDialog();
PostMessage(MYWM_POSTINIT,0,0);
return TRUE;
}
// Handle CDN_INITDONE: shows that list view still not created yet.
//
void CMyOpenDlg::OnInitDone()
{
CFileDialog::OnInitDone();
}
// Handle MYWN_POSTINIT: finally, the list view is created.
//
LRESULT CMyOpenDlg::OnPostInit(WPARAM wp, LPARAM lp)
{
// SetListView(ODM_VIEW_DETAIL); // this will succeed
SetListView(LISTVIEWCMD(0x702d)); // this will succeed
return 0;
/*
//LISTVIEWCMD //ODM_VIEW_LIST
enum LISTVIEWCMD
{ ODM_VIEW_ICONS = 0x7029,
ODM_VIEW_LIST = 0x702b,
ODM_VIEW_DETAIL= 0x702c,
ODM_VIEW_THUMBS= 0x702d,
ODM_VIEW_TILES = 0x702e,
};
*/
}
// Change the list view to desired mode if the view exists.
// Display TRACE diagnostics either way.
//
BOOL CMyOpenDlg::SetListView(LISTVIEWCMD cmd){
// Note real dialog is my parent, not me!
CWnd* pshell = GetParent()->GetDlgItem(lst2);
if (pshell) {
// SHELLDLL_DefView window found: send it the command.
pshell->SendMessage(WM_COMMAND, cmd);
return TRUE;
}
return FALSE;
}
date: Sat, 24 May 2008 16:27:00 -0700
author: ChangChiTheGraphics
|
|