// JP opened flex table

Click to See Complete Forum and Search --> : CFileDialog doesn't work


mykemaas
February 20th, 2002, 02:17 PM
I am using Windows XP pro with Visual Studio .NET. My project has been converted from Visual C++ 6.0 to Visual C++ .NET. While my MFC application works perfectly on my XP machine, the CFileDialog common dialog doesn't display on my Windows 98 machine. I have tried compiling my application both with static and dynamic MFC libaraies, but it still doesn't work. Does anyone have any suggestions?

mykemaas
February 20th, 2002, 04:24 PM
Additional information: I caught the CommDlgExtendedError return value and received CDERR_STRUCTSIZE, which the help describes as "The lStructSize member of the initialization structure for the corresponding common dialog box is invalid." I have found the lStructSize member in the m_pOFN structure in the CFileDialog class. I would like to know what is a valid lStructSize.

mykemaas
February 20th, 2002, 04:42 PM
the lStructSize member of m_pOFN reports that it equals 88. In addition, I have been able to test on 2 other Windows 98 machines with the same result... no File open Dialog.

By the way... the code I am using to initiate the file dialog is as follows:


CFileDialog dlg( TRUE, ".bmp", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "BMP Files (*.bmp)|*.bmp||", this);

if(dlg.DoModal() == IDOK)
{
...
}

mykemaas
February 20th, 2002, 05:43 PM
Figured it out... I created a test app using CFileDialog. The app worked perfectly on my Windows 98 machine. So, I began to compare the differences. The difference was in the stdafx.h header file. As it turns out, Visual C++ .NET looks for the presence and definition of certain macros to enable or disable features specific to a platform (95, 98, ME, NT, 2000, XP). The defines are as follows:



// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.
#define WINVER 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif

#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
#endif





These defines set the target platform features included in your build. As it turns out, my VC++ 6.0 app didn't have any of the above defines, so Visual Studio .NET assumed I was targeting Windows XP, hence including features not compatible with Windows 98. I simply copied the defines from my VC++ .NET generated app int the stdafx.h of my app imported from VC++ 6.0, and viola! It worked with 98.

~myke

Troy Erickson
September 24th, 2002, 04:30 PM
I just spent 5 hours trying to figure out why my open dialogs were not working too. I was going down the path of checking dll versions etc. Thanks for posting your results. I was starting to cuss micrsoft very loudly.

HrnjicaMujo
October 3rd, 2002, 04:00 AM
Thanks a lot. I spent 5 days to figure what is wrong.

//JP added flex table