home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / MFCINC.PAK / AFXDLL_.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  3.1 KB  |  106 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. // afxdll_.h - extensions to AFXWIN.H used for the 'AFXDLL' version
  12. // This file contains MFC library implementation details as well
  13. //   as APIs for writing MFC Extension DLLs.
  14. // Please refer to Technical Note 033 (TN033) for more details.
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef _AFXDLL
  19.     #error file must be compiled with _AFXDLL
  20. #endif
  21.  
  22. #ifdef _AFX_PACKING
  23. #pragma pack(push, _AFX_PACKING)
  24. #endif
  25.  
  26. #undef AFX_DATA
  27. #define AFX_DATA AFX_CORE_DATA
  28.  
  29. /////////////////////////////////////////////////////////////////////////////
  30.  
  31. // AFX_EXTENSION_MODULE - special struct used during DLL initialization
  32.  
  33. struct AFX_EXTENSION_MODULE
  34. {
  35.     BOOL bInitialized;
  36.     HMODULE hModule;
  37.     HMODULE hResource;
  38.     CRuntimeClass* pFirstSharedClass;
  39.     COleObjectFactory* pFirstSharedFactory;
  40. };
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CDynLinkLibrary - for implementation of MFC Extension DLLs
  44.  
  45. class COleObjectFactory;
  46.  
  47. class CDynLinkLibrary : public CCmdTarget
  48. {
  49.     DECLARE_DYNAMIC(CDynLinkLibrary)
  50. public:
  51.  
  52. // Constructor
  53.     CDynLinkLibrary(AFX_EXTENSION_MODULE& state, BOOL bSystem = FALSE);
  54.  
  55. // Attributes
  56.     HMODULE m_hModule;
  57.     HMODULE m_hResource;                // for shared resources
  58.     CTypedSimpleList<CRuntimeClass*> m_classList;
  59. #ifndef _AFX_NO_OLE_SUPPORT
  60.     CTypedSimpleList<COleObjectFactory*> m_factoryList;
  61. #endif
  62.     BOOL m_bSystem;                     // TRUE only for MFC DLLs
  63.  
  64. // Implementation
  65. public:
  66.     CDynLinkLibrary* m_pNextDLL;        // simple singly linked list
  67.     virtual ~CDynLinkLibrary();
  68.  
  69. #ifdef _DEBUG
  70.     virtual void AssertValid() const;
  71.     virtual void Dump(CDumpContext& dc) const;
  72. #endif //_DEBUG
  73. };
  74.  
  75. // call in every DLL_PROCESS_ATTACH
  76. BOOL AFXAPI AfxInitExtensionModule(AFX_EXTENSION_MODULE&, HMODULE hMod);
  77. // call on every DLL_PROCESS_DETACH
  78. void AFXAPI AfxTermExtensionModule(AFX_EXTENSION_MODULE&, BOOL bAll = FALSE);
  79.  
  80. // special function(s) for stand-alone DLLs (and controls)
  81. void AFXAPI AfxCoreInitModule();
  82. #if (defined(_DEBUG) || defined(_MAC)) && !defined(_AFX_MONOLITHIC)
  83. void AFXAPI AfxOleInitModule();
  84. void AFXAPI AfxNetInitModule();
  85. void AFXAPI AfxDbInitModule();
  86. #else
  87. #define AfxOleInitModule()
  88. #define AfxNetInitModule()
  89. #define AfxDbInitModule()
  90. #endif
  91.  
  92. // special functions for loading and freeing MFC extension DLLs
  93. // (necessary if your app is multithreaded and loads extension
  94. //  DLLs dynamically)
  95. HINSTANCE AFXAPI AfxLoadLibrary(LPCTSTR lpszModuleName);
  96. BOOL AFXAPI AfxFreeLibrary(HINSTANCE hInstLib);
  97.  
  98. #undef AFX_DATA
  99. #define AFX_DATA
  100.  
  101. #ifdef _AFX_PACKING
  102. #pragma pack(pop)
  103. #endif
  104.  
  105. /////////////////////////////////////////////////////////////////////////////
  106.