Customizing a File open dialog with CFileDialog.
Ron Jacobs -- Ron.Jacobs@centurasoft.com Thursday, January 30, 1997 Environment: MSVC 2.2, Win NT 4.0 I am trying to add a list box to the bottom of a file open dialog. According to the Win32 SDK... "You can customize an Explorer-style Open or Save As dialog box by providing a hook procedure, a custom template, or both." This sounds like I don't have to provide a hook procedure, but if I try to construct a CFileDialog as follows I get ASSERTS from MFC complaining that there is no hook procedure. CFileDialog FDlg(TRUE); FDlg.m_ofn.hInstance = AfxGetInstanceHandle(); FDlg.m_ofn.lpstrFilter = szFilter; FDlg.m_ofn.Flags = OFN_ENABLETEMPLATE | OFN_EXPLORER; FDlg.m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_DIALOG1); FDlg.DoModal(); I looked at the MFC hook procedure _AfxCommDlgProc and it occured to me that I probably do have to provide a hook proc to handle the messages for my dialog template. But rather than write an old fashioned switch etc. I would like to find a way to use the message maps of the class associated with IDD_DIALOG1. Can I use the WndProc for my dialog class as the hook proc? If so, how? Thanks, Ron Jacobs Centura Software
Kenneth A. Argo -- argo@rias.COM Monday, February 03, 1997 You do not use the OFN_ENABLETEMPLATE for explorer dialogs. The trick = is in the dialog itself. You must enable the extended flag which tells = the dialog it is a child of another control. Kind of backwards from the = usual. Anyway; set the "Control" bit in the "More Styles" page of your = dialog. Then add a static where you want the explorer and name is = "stc32". That's all their is to it. No need to do anything with the = template stuff MFC handles that for you when you create the class for = your dialog. I have one working that I could send you pieces of if you still have = trouble. Ken ---------- From: Ron Jacobs[SMTP:Ron.Jacobs@centurasoft.com] Sent: Thursday, January 30, 1997 1:05 PM To: mfc-l@netcom.com Subject: Customizing a File open dialog with CFileDialog. Environment: MSVC 2.2, Win NT 4.0 =20 I am trying to add a list box to the bottom of a file open dialog. =20 According to the Win32 SDK... =20 "You can customize an Explorer-style Open or Save As dialog box by=20 providing a hook procedure, a custom template, or both." =20 This sounds like I don't have to provide a hook procedure, but if I = try to construct a CFileDialog as follows I get ASSERTS from MFC=20 complaining that there is no hook procedure. =20 CFileDialog FDlg(TRUE); =20 =20 FDlg.m_ofn.hInstance =3D AfxGetInstanceHandle(); FDlg.m_ofn.lpstrFilter =3D szFilter; FDlg.m_ofn.Flags =3D OFN_ENABLETEMPLATE | OFN_EXPLORER; FDlg.m_ofn.lpTemplateName =3D MAKEINTRESOURCE(IDD_DIALOG1); FDlg.DoModal(); =20 =20 I looked at the MFC hook procedure _AfxCommDlgProc and it occured = to=20 me that I probably do have to provide a hook proc to handle the=20 messages for my dialog template. =20 But rather than write an old fashioned switch etc. I would like to = find a way to use the message maps of the class associated with=20 IDD_DIALOG1. =20 Can I use the WndProc for my dialog class as the hook proc? =20 If so, how? =20 =20 =20 Thanks, =20 Ron Jacobs Centura Software =20
| Вернуться в корень Архива |