Главная страница | назад





Article #22880: Using an OPENFILENAME structure and GetOpenFilename in Windows 98

When developing applications for Windows, be aware that the Windows SDK header files may not fit for the exact platform you are targeting. There are a number of preprocessor symbols you must define to be sure your application will run on your targeted windows platform. The MSDN has a convenient table that should be used as a guide.

As with any guideline or rule, there are always exceptions to consider. Even following the guidelines, you may run into a problem using GetOpenFilename on Windows98. The dialog may not appear but will return an error code indicating that the size parameter of the structure is incorrect. Indeed, the size is incorrect.

If you are compiling for Windows 2000, the OPENFILENAME structure has an extra 3 members that Windows 98 does not expect. Look in "commdlg.h" for the actual code. As mentioned by this MSDN entry the solution to this is to use "OPENFILENAME_SIZE_VERSION_400" for the lStructSize member of the structure, rather than the usual "sizeof(OPENFILENAME)."

Last Modified: 20-APR-01