afxdll_.h 3.2 KB

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