I have installed Platform SDK Windows Server 2003 (I work in VS 6.0 on WinXP) and I have a problem with CFileDialog.
This code
Code:
void CFileTestView::OnViewFile()
{
CFileDialog dlg(TRUE);
dlg.DoModal();
}
worked just fine before defining _WIN32_WINNT, which I need to use different functions and constants. Now, when I define it
Code:
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
my code just crashes in ~CFileDialog (when dlg does out of scope and is destroyed). Since m_ofn member of CFileDialog depends on this _WIN32_WINT:
Code:
typedef struct tagOFN {
// ...
#if (_WIN32_WINNT >= 0x0500)
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
#endif // (_WIN32_WINNT >= 0x0500)
} OPENFILENAME
I rewrote the code this way:
Code:
void CFileTestView::OnViewFile()
{
CFileDialog dlg(TRUE);
#if (_WIN32_WINNT >= 0x0500)
dlg.m_ofn.pvReserved = NULL;
dlg.m_ofn.dwReserved = 0;
dlg.m_ofn.FlagsEx = 0;
#endif
dlg.DoModal();
}
but I still get a first-chance exception in FileTest.Exe (KERNEL32.dll) 0xC0000005: Access Violation (the usual stuff).
Any ideas? Thanks!