home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 21 / IOPROG_21.ISO / SOFT / DEMOT.ZIP / Src / Include / ModulVer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-23  |  2.0 KB  |  69 lines

  1. ////////////////////////////////////////////////////////////////
  2. // 1998 Microsoft Systems Journal
  3. //
  4. // If this code works, it was written by Paul DiLascia.
  5. // If not, I don't know who wrote it.
  6. //
  7.  
  8. #if !defined(MODULVER_H_INCLUDED)
  9. #define MODULVER_H_INCLUDED
  10.  
  11. #if _MSC_VER >= 1000
  12. #pragma once
  13. #endif // _MSC_VER >= 1000
  14.  
  15. // tell linker to link with version.lib for VerQueryValue, etc.
  16. #pragma comment(linker, "/defaultlib:version.lib")
  17.  
  18. #ifndef DLLVERSIONINFO
  19. // following is from shlwapi.h, in November 1997 release of the Windows SDK
  20.  
  21. typedef struct _DllVersionInfo
  22. {
  23.         DWORD cbSize;
  24.         DWORD dwMajorVersion;                   // Major version
  25.         DWORD dwMinorVersion;                   // Minor version
  26.         DWORD dwBuildNumber;                    // Build number
  27.         DWORD dwPlatformID;                     // DLLVER_PLATFORM_*
  28. } DLLVERSIONINFO;
  29.  
  30. // Platform IDs for DLLVERSIONINFO
  31. #define DLLVER_PLATFORM_WINDOWS         0x00000001      // Windows 95
  32. #define DLLVER_PLATFORM_NT              0x00000002      // Windows NT
  33.  
  34. #endif // DLLVERSIONINFO
  35.  
  36. //////////////////
  37. // CModuleVersion version info about a module.
  38. // To use:
  39. //
  40. // CModuleVersion ver
  41. // if (ver.GetFileVersionInfo("_T("mymodule))) {
  42. //        // info is in ver, you can call GetValue to get variable info like
  43. //        CString s = ver.GetValue(_T("CompanyName"));
  44. // }
  45. //
  46. // You can also call the static fn DllGetVersion to get DLLVERSIONINFO.
  47. //
  48.  
  49. class CLASS_EXPORT CModuleVersion : public VS_FIXEDFILEINFO {
  50. protected:
  51.     BYTE* m_pVersionInfo;    // all version info
  52.  
  53.     struct TRANSLATION {
  54.         WORD langID;            // language ID
  55.         WORD charset;            // character set (code page)
  56.     } m_translation;
  57.  
  58. public:
  59.     CModuleVersion();
  60.     virtual ~CModuleVersion();
  61.  
  62.     BOOL        GetFileVersionInfo(LPCTSTR modulename);
  63.     CString    GetValue(LPCTSTR lpKeyName);
  64.     static BOOL DllGetVersion(LPCTSTR modulename, DLLVERSIONINFO& dvi);
  65.     static int GetModuleVer(CString cs);
  66. };
  67.  
  68. #endif
  69.