After you call DoModal, try calling other method - if it fails, you need to remove the 'delete'. WHY?
Well, that just a guess/suggestion - it may be that CFileDialog, when allocated in heap, might be calling "delete this" in it's PostNCDestroy. Just like Frame and Views - I know frame/views are always allocated in heap not in stack. But this may be the case...
All this seems to be problem with 'pvReserved' data member. Try setting it to NULL before you delete. You may also try IsBadWritePtr/IsBadReadPtr on 'pvReserved' and/or to dialog object itself.
If you look at my first post you see that I already set pvReserved to NULL and dwReserved to 0. After calling DoModal(), they are unchanged, NULL and 0. And I also set lStructSize = sizeof(OPENFILENAME).
I suggest you to find out the solution in stack version of your class, because making changes this way would increase problems. For the time being, it is better to "ignore" something and move forward...
MFC70 has 7th parameter to give the sizeof OPENFILENAME structure, which does not exist in MFC42 (6.0v). We can set it as:
Code:
f.m_ofn.lStructSize = sizeof(OPENFILENAME);
While debugging this thing, I found that 'lStructSize' is 76, which when the above code comes, becomes 88. I have defined
Code:
#define _WIN32_WINNT 0x500
in stdafx.h (before ALL headers).
Instead of this CFileDialog is compiled using OLD value of _WIN32_WINNT, and my code is compiled using new value (88 shows!).
Worth mentioning that I am using this thing, so that new-style dialog box (History, My computer, Network Places) appear on my dialog. I got success in that, but not AV problem!
I think your problem might have something to do with the precompiled headers.Try defininning that value in the project settings ( ++ options) and not in your code.
Bookmarks