home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / convreg.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  3KB  |  82 lines

  1. // --convreg.h------------------------------------------------------------------
  2. // 
  3. //  Conversion registry class.
  4. //  Locates converters that are stored in DLLs from info stored in the 
  5. //  registry.
  6. //
  7. // Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.
  8. //
  9. // -----------------------------------------------------------------------------
  10.  
  11. #if !defined(_CONVREG_H)
  12. #define _CONVREG_H
  13.  
  14. //$$--CEDKConvReg--------------------------------------------------------------
  15. //
  16. //  DESCRIPTION: the conversion registry keeps track of conversion configuration.
  17. //
  18. // ---------------------------------------------------------------------------
  19. class CEDKConvReg
  20. {
  21. public:
  22.  
  23.     CEDKConvReg() ;
  24.     ~CEDKConvReg() ;
  25.  
  26.     HRESULT HrEDKInitialize() ;
  27.  
  28.     HRESULT HrEDKSearchOpen(
  29.         IN LPCWSTR pszConversionPoint,
  30.         IN LPCWSTR pszContentClass,
  31.         OUT CDllEntryPoint * &pep) ;
  32.  
  33.     HRESULT HrEDKSearchNext() ;
  34.  
  35.     void EDKSearchClose() ;
  36.  
  37.     void EDKDumpMappings() ;
  38.  
  39.     // Deletes common member data (static class names list & DLL cache)
  40.     void EDKFree() ;
  41.  
  42.     // function to retrieve a cached DLL handle
  43.     static inline HRESULT CEDKConvReg::HrGetDllHandle(
  44.         IN LPWSTR pszDllName,       // name of DLL to get instance handle for
  45.         OUT HINSTANCE * phInst)     // instance handle pointer
  46.     {
  47.         ASSERTERROR(ms_pDllCache != NULL, "Bad ms_pDllCache");
  48.  
  49.         RETURN(((CDllCache *) CEDKConvReg::ms_pDllCache)->HrFind(pszDllName, phInst));
  50.     }
  51.  
  52. protected:   
  53.     // helper functions
  54.     HRESULT HrEDKParseConfiguration() ;
  55.     HRESULT HrEDKRecordValues(
  56.         IN HKEY const hkEntryPoint, 
  57.         IN LPCWSTR pszDll, 
  58.         IN LPCWSTR pszEntryPoint) ;
  59.     VOID EDKSyntaxError(
  60.         IN LPWSTR pszDll,
  61.         IN LPWSTR pszEntryPoint,
  62.         IN LPWSTR pszClass,
  63.         IN LPWSTR pszOptions,
  64.         IN LPWSTR pszPoint) ;
  65.  
  66.     // common values
  67.     BOOL m_bSyntaxError ;                           // true when a syntax error has occurred.
  68.  
  69.     // common storage
  70.     static HKEY ms_hkConversions ;                  // handle to conversion data in registry
  71.     static CClassName * ms_pcnClasses ;             // in memory cache of conversion data
  72.     static CDllCache * ms_pDllCache;                // DLL instance handle cache
  73.  
  74.     // cursor information
  75.     CDllEntryPoint ** m_ppep ;                      // where to store the entry point pointer
  76.     CClassName * m_pcnCurrentClass ;                // current class.
  77.     LPCWSTR m_pszConversionPoint ;                  // name of conversion point.
  78.     LPCWSTR m_pszContentClass ;                     // name of class
  79. } ;
  80.  
  81. #endif
  82.