- memset(&of, 0, sizeof(OPENFILENAME));
-
- of.lpstrCustomFilter = NULL; // system should not save custom filter
- of.nMaxCustFilter = 0L;
-
- of.nFileOffset = 0; // 0-based pointer to filname in lpstFile
- of.nFileExtension = 0; // 0-based pointer to extension in lpstrFile
- of.lpstrDefExt = NULL; // no default extension
-
+ wxZeroMemory(of);
+
+ // the OPENFILENAME struct has been extended in newer version of
+ // comcdlg32.dll, but as we don't use the extended fields anyhow, set
+ // the struct size to the old value - otherwise, the programs compiled
+ // with new headers will not work with the old libraries
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
+ of.lStructSize = sizeof(OPENFILENAME) -
+ (sizeof(void *) + 2*sizeof(DWORD));
+#else // old headers