From: LFSoftDev on
Hello

I have tried using the CFileException Dialog it crashes on the command
..DoModal.

I have tried the exact code listed here and get tthe same result:
http://msdn.microsoft.com/en-us/library/dk77e5e7.aspx

And also tried creating a pointer and doing ->DoModal();

All of these cause an 'exeption error:Procedure not found' at CallWindowProc
in wincore.cpp

This line appears higher up the call stack - I am using windows vista, that
may be relevant.
HRESULT hr =
(static_cast<IFileDialog*>(m_pIFileDialog))->Show(m_ofn.hwndOwner);

I have also tried placing a color dialog ad the same position in the code
and calling it using doModal and it calls fine and there is no error.

Does anyone have any ideas as to what I may be doing wrong or what I can try
to stop the crash?

Liam
From: AliR (VC++ MVP) on
Please post some code that shows what you are passing the CFileDialog
constructor. (Assuming that you are talking about CFileDialog and not
CFileException Dialog whatever that might be!)

AliR.


"LFSoftDev" <LFSoftDev(a)discussions.microsoft.com> wrote in message
news:8F5B2DE2-993C-47B7-970A-000613549C19(a)microsoft.com...
> Hello
>
> I have tried using the CFileException Dialog it crashes on the command
> .DoModal.
>
> I have tried the exact code listed here and get tthe same result:
> http://msdn.microsoft.com/en-us/library/dk77e5e7.aspx
>
> And also tried creating a pointer and doing ->DoModal();
>
> All of these cause an 'exeption error:Procedure not found' at
> CallWindowProc
> in wincore.cpp
>
> This line appears higher up the call stack - I am using windows vista,
> that
> may be relevant.
> HRESULT hr =
> (static_cast<IFileDialog*>(m_pIFileDialog))->Show(m_ofn.hwndOwner);
>
> I have also tried placing a color dialog ad the same position in the code
> and calling it using doModal and it calls fine and there is no error.
>
> Does anyone have any ideas as to what I may be doing wrong or what I can
> try
> to stop the crash?
>
> Liam

From: Giovanni Dicanio on

"LFSoftDev" <LFSoftDev(a)discussions.microsoft.com> ha scritto nel messaggio
news:8F5B2DE2-993C-47B7-970A-000613549C19(a)microsoft.com...

> I have tried using the CFileException Dialog it crashes on the command
> .DoModal.
>
> I have tried the exact code listed here and get tthe same result:
> http://msdn.microsoft.com/en-us/library/dk77e5e7.aspx

Considering the code link, you meant CFileDialog (not CFileExceptionDialog),
right?

I've tried a simple MFC dialog-based wizard-created app, then put a button
and copied and pasted the aforementioned code from MSDN, and I have no
exceptions.

You can check yourself from this download (source + exe):

http://www.geocities.com/giovanni.dicanio/temp/TestVistaFileDialog.zip

Giovanni


From: LFSoftDev on
Thank you both for your replies.

Apologies for the mistake. I wrote that post very late in the evening. I did
mean CFileDialog.

I have tried passing a few things to the constructor. Always with the same
result.
CFileDialog dlg(TRUE, _T("txt"), _T("*.txt"), OFN_ALLOWMULTISELECT);
CFileDialog dlg(true);
CFileDialog dlg(false);
CFileDialog *dlg = new dlg(false);
I get the same response with my save and my open code but not if I use a
different dialog. - I tried the color dialog and it worked fine.

I do not have access to visual studio until this evening so I will post a
reply to you on that then. Thank you for creating the test though.

Liam
From: Giovanni Dicanio on

"LFSoftDev" <LFSoftDev(a)discussions.microsoft.com> ha scritto nel messaggio
news:2A451F92-3606-4241-85F1-945F4C77B5F2(a)microsoft.com...

> Apologies for the mistake. I wrote that post very late in the evening. I
> did
> mean CFileDialog.

No problem.


> I have tried passing a few things to the constructor. Always with the same
> result.
> CFileDialog dlg(TRUE, _T("txt"), _T("*.txt"), OFN_ALLOWMULTISELECT);
> CFileDialog dlg(true);
> CFileDialog dlg(false);
> CFileDialog *dlg = new dlg(false);

The first parameter in CFileDialog is of type BOOL, so I would use TRUE or
FALSE for code coherence.
Moreover, I would just create the CFileDialog instance with stack-semantic,
I see no advantage here in using the dynamic creation with operator new
(which requires a delete, too).

> I do not have access to visual studio until this evening so I will post a
> reply to you on that then. Thank you for creating the test though.

You're welcome.
Note that I used VS2008 to build the test code.
In VS2008's MFC, there is a last parameter in CFileDialog constructor that
is of type BOOL, named 'bVistaStyle'. It's default value is TRUE.

http://msdn.microsoft.com/en-us/library/wh5hz49d.aspx

If you are compiling the code with a previous version of VS, I think that
MFC does not support the new Vista-style dialogs; e.g. consulting MSDN
documentation for CFileDialog constructor in VS2005, shows that the
bVistaStyle parameter is missing in that older version:

http://msdn.microsoft.com/en-us/library/wh5hz49d(VS.80).aspx

Moreover, if you are using VS2008, make sure that you enabled the new Vista
features, properly #define'ing preprocessor macros like WINVER to 0x0600
(Windows Vista is "Windows 6" in their internal numbering system) in
"targetver.h" file.

HTH,
Giovanni


 |  Next  |  Last
Pages: 1 2 3
Prev: Strings again :(
Next: Pass CWnd or CView to DLL