Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.1 KiB

  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. #if _MFC_VER >= 0x0600
  43. CDynLinkLibrary(HINSTANCE hModule, HINSTANCE hResource);
  44. #endif
  45. // Attributes
  46. HMODULE m_hModule;
  47. HMODULE m_hResource; // for shared resources
  48. CTypedSimpleList<CRuntimeClass*> m_classList;
  49. #ifndef _AFX_NO_OLE_SUPPORT
  50. CTypedSimpleList<COleObjectFactory*> m_factoryList;
  51. #endif
  52. BOOL m_bSystem; // TRUE only for MFC DLLs
  53. // Implementation
  54. public:
  55. CDynLinkLibrary* m_pNextDLL; // simple singly linked list
  56. virtual ~CDynLinkLibrary();
  57. #ifdef _DEBUG
  58. virtual void AssertValid() const;
  59. virtual void Dump(CDumpContext& dc) const;
  60. #endif //_DEBUG
  61. };
  62. // call in every DLL_PROCESS_ATTACH
  63. BOOL AFXAPI AfxInitExtensionModule(AFX_EXTENSION_MODULE&, HMODULE hMod);
  64. // call on every DLL_PROCESS_DETACH
  65. void AFXAPI AfxTermExtensionModule(AFX_EXTENSION_MODULE&, BOOL bAll = FALSE);
  66. // special function(s) for stand-alone DLLs (and controls)
  67. void AFXAPI AfxCoreInitModule();
  68. #if defined(_DEBUG) && !defined(_AFX_MONOLITHIC)
  69. void AFXAPI AfxOleInitModule();
  70. void AFXAPI AfxNetInitModule();
  71. void AFXAPI AfxDbInitModule();
  72. #else
  73. #define AfxOleInitModule()
  74. #define AfxNetInitModule()
  75. #define AfxDbInitModule()
  76. #endif
  77. // special functions for loading and freeing MFC extension DLLs
  78. // (necessary if your app is multithreaded and loads extension
  79. // DLLs dynamically)
  80. HINSTANCE AFXAPI AfxLoadLibrary(LPCTSTR lpszModuleName);
  81. BOOL AFXAPI AfxFreeLibrary(HINSTANCE hInstLib);
  82. #undef AFX_DATA
  83. #define AFX_DATA
  84. #ifdef _AFX_PACKING
  85. #pragma pack(pop)
  86. #endif
  87. /////////////////////////////////////////////////////////////////////////////