Customized File Open/Save Dialog problem 
Author Message
 Customized File Open/Save Dialog problem

Hi

I have customized the Open/Save common
dialog boxes, available in MFC. I have a
new dialog template with some extra controls
and  it seems to work ok.

I dont seem to be able to override
the default handler for the Save/Load
button. In fact, I have not been successful
overriding the CWnd::PreTranslateMessage
function.

Is it possible to override the default operation
for the Open/Save button on this dialog?

Thanks

Rob.



Fri, 02 Jan 2004 23:31:29 GMT  
 Customized File Open/Save Dialog problem
Hi Rob,

Sorry, this is not to answer your question.

I'd like to ask how did you do to have extra controls in
the common Open/Save-As. I just want a static text below
the [Save as File type] but couldn't do it. What I have
done is to create another diaglog box with that static
text and set
OPENFILENAME ofn flags like:
 + ofn.hInstance = AfxGetInstanceHandle();
 + ofn.Flags = OFN_OVERWRITEPROMPT | OFN_SHOWHELP |
OFN_ENABLETEMPLATE | OFN_EXPLORER;
 + ofn.lpTemplateName = _T("IDD_CUSTOM_SAVEAS");

where IDD_CUSTOM_SAVEAS is the name of the new Dialog I
just added, then I call GetSaveFileName(&ofn); -> no luck!

Thanks for your help in advance.
Tuan.

Quote:
>-----Original Message-----
>Hi

>I have customized the Open/Save common
>dialog boxes, available in MFC. I have a
>new dialog template with some extra controls
>and  it seems to work ok.

>I dont seem to be able to override
>the default handler for the Save/Load
>button. In fact, I have not been successful
>overriding the CWnd::PreTranslateMessage
>function.

>Is it possible to override the default operation
>for the Open/Save button on this dialog?

>Thanks

>Rob.
>.



Sat, 03 Jan 2004 05:46:43 GMT  
 Customized File Open/Save Dialog problem
Hi,

To add a new control to the standard open/save dialog, you need to derive
your class from CFileDialog. Let's say, the new dialog is CMyFileDialog.

Override OnInitDialog() function of CMyFileDialog and add the following
line to add a static control below the "save as file type" combo box.

BOOL CMyFileDialog::OnInitDialog()
{
        CFileDialog::OnInitDialog();

        CRect rect;
        CWnd* wndDlg=GetParent( );

        (wndDlg->GetDlgItem(cmb1))->GetWindowRect(&rect); //cmb1 is defined in
dlgs.h, it's the ID of the "save as file type" box.
        ScreenToClient(&rect);
        rect.top+=30; //you can adjust this number based on your screen resolution
        rect.bottom+=30;
        m_mystatic.Create(_T("mystatic"),WS_CHILD|WS_VISIBLE,rect,wndDlg,1);

Quote:
}

Here, m_mystatic is the member variable of CMyFileDialog.

Cheers,
Kelton



Sat, 03 Jan 2004 17:07:32 GMT  
 Customized File Open/Save Dialog problem
It really works, Kelton! I might have some very old instructions on MSDN
since they did not mention about deriving a sub-class of CFileDialog. (FYI:
http://support.microsoft.com/support/kb/articles/Q102/3/32.asp)

Thank you very much.
Tuan.


Quote:
> Hi,

> To add a new control to the standard open/save dialog, you need to derive
> your class from CFileDialog. Let's say, the new dialog is CMyFileDialog.

> Override OnInitDialog() function of CMyFileDialog and add the following
> line to add a static control below the "save as file type" combo box.

> BOOL CMyFileDialog::OnInitDialog()
> {
> CFileDialog::OnInitDialog();

>   CRect rect;
> CWnd* wndDlg=GetParent( );

> (wndDlg->GetDlgItem(cmb1))->GetWindowRect(&rect); //cmb1 is defined in
> dlgs.h, it's the ID of the "save as file type" box.
> ScreenToClient(&rect);
> rect.top+=30; //you can adjust this number based on your screen resolution
> rect.bottom+=30;
> m_mystatic.Create(_T("mystatic"),WS_CHILD|WS_VISIBLE,rect,wndDlg,1);
> }

> Here, m_mystatic is the member variable of CMyFileDialog.

> Cheers,
> Kelton



Sun, 04 Jan 2004 04:42:37 GMT  
 Customized File Open/Save Dialog problem
Hi Rob,

Regarding this problem, I wonder if you have tried
RegisterWindowMessage(FILEOKSTRING)? Then, use the ON_REGISTERED_MESSAGE
macro to handle this registered message. You can find an API sample in the
MSDN article below:

http://msdn.microsoft.com/library/en-us/dnmgmt/html/msdn_cmndlg32.asp

Hope the above helps.

Regards,
Leo



Sun, 04 Jan 2004 10:29:29 GMT  
 Customized File Open/Save Dialog problem
If you are using the explorer style file dialog, take a look at the
CDN_FILEOK message in MSDN. The CDN_FILEOK message is posted when the user
clicks the Open/Save button.

--
Pete
http://www3.telus.net/pja/


Quote:
> Hi

> I have customized the Open/Save common
> dialog boxes, available in MFC. I have a
> new dialog template with some extra controls
> and  it seems to work ok.

> I dont seem to be able to override
> the default handler for the Save/Load
> button. In fact, I have not been successful
> overriding the CWnd::PreTranslateMessage
> function.

> Is it possible to override the default operation
> for the Open/Save button on this dialog?

> Thanks

> Rob.



Sun, 04 Jan 2004 10:38:54 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Problem with customized File Open Dialog

2. Change file index filter of the standard file open/save dialog

3. Customized File Open Dialog

4. Customizing Open File Dialog -- am I right?

5. Customizing Open File Dialog -- am I right?

6. DDX member variables are not updated in Customized Open File Dialog

7. Customize standard file open dialog list view control

8. customizing Open File Dialog...

9. problem with customized file save template

10. File dialog of Open/Save

11. File Open / Save As dialog overriding

12. Common Dialogs File Open, Save As

 

 
Powered by phpBB® Forum Software