Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GetOpenFileName structure member variable is tricky...

GetOpenFileName structure member variable is tricky...

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andreir23
    wrote on last edited by
    #1

    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! ;-)

    A 1 Reply Last reply
    0
    • A andreir23

      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! ;-)

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      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,

      A 1 Reply Last reply
      0
      • A Anonymous

        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,

        A Offline
        A Offline
        andreir23
        wrote on last edited by
        #3

        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? :-)

        T 1 Reply Last reply
        0
        • A andreir23

          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? :-)

          T Offline
          T Offline
          TiberiusvP
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups