GetOpenFileName structure member variable is tricky...
-
Here is my problem: In order to use GetOpenFileName I use a OPENFILENAME structure which has a member variable called lStructSize. In MSDN I am advised to use sizeof(OPENFILENAME) to initialize this one IF WINDOWS IS WIN2000 OR LATER!!! otherwise I should use OPENFILENAME_SIZE_VERSION_400. All is fine. I determine which type of Windows is my app running and use different initializations but this OPENFILENAME_SIZE_VERSION_400 seems undefined! What can I do?! TNX! ;-)
-
Here is my problem: In order to use GetOpenFileName I use a OPENFILENAME structure which has a member variable called lStructSize. In MSDN I am advised to use sizeof(OPENFILENAME) to initialize this one IF WINDOWS IS WIN2000 OR LATER!!! otherwise I should use OPENFILENAME_SIZE_VERSION_400. All is fine. I determine which type of Windows is my app running and use different initializations but this OPENFILENAME_SIZE_VERSION_400 seems undefined! What can I do?! TNX! ;-)
-
OPENFILENAME_SIZE_VERSION_400 is defined in <commdlg.h> Call GetVersion[Ex] to determine which version of Windows your application is running on then set the lStructSize field of the OPENFILENAME accordingly. Regards,
It doesn't work! My commdlg.h header file supplied with VC++6 does *not* include this definition at all. In fact no .h file from my distribution doesn't contain it. In a moment of desperation I searched brute-force-style ALL files on the hard drive for this string. None. Except cache files of Opera (web browser and text files that I wrote). Let's say I might (??!) have an incomplete distribution of this Visual Studio. What if I would nicely ask you if you could tell me the number value of this constant? It's probably unnecessary to tell you how to do that. Thank you. PS: Could it be the fact that I don't really like C ?!? Maybe it has a mind of its own and senses my hate? :-)
-
It doesn't work! My commdlg.h header file supplied with VC++6 does *not* include this definition at all. In fact no .h file from my distribution doesn't contain it. In a moment of desperation I searched brute-force-style ALL files on the hard drive for this string. None. Except cache files of Opera (web browser and text files that I wrote). Let's say I might (??!) have an incomplete distribution of this Visual Studio. What if I would nicely ask you if you could tell me the number value of this constant? It's probably unnecessary to tell you how to do that. Thank you. PS: Could it be the fact that I don't really like C ?!? Maybe it has a mind of its own and senses my hate? :-)
had the same problem.
// compatibility with the old (vc6.0) headers #if (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400) #ifndef CDSIZEOF_STRUCT #define CDSIZEOF_STRUCT(structname, member) (((int)((LPBYTE)(&((structname*)0)->member) - ((LPBYTE)((structname*)0)))) + sizeof(((structname*)0)->member)) #endif #define OPENFILENAME_SIZE_VERSION_400A CDSIZEOF_STRUCT(OPENFILENAMEA,lpTemplateName) #define OPENFILENAME_SIZE_VERSION_400W CDSIZEOF_STRUCT(OPENFILENAMEW,lpTemplateName) #ifdef UNICODE #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400W #else #define OPENFILENAME_SIZE_VERSION_400 OPENFILENAME_SIZE_VERSION_400A #endif // !UNICODE #endif // (_WIN32_WINNT >= 0x0500) && !defined(OPENFILENAME_SIZE_VERSION_400)
found it on http://codeworks.gnomedia.com/wtl/wtldocs/atldlgs\_8h-source.html hope it will help. greetz tib ---------------------------------------------------------- I once had a nightmare in binary --- I think there was a 2