home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / COMPOUND.ZIP / gstg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-11-01  |  2.6 KB  |  98 lines

  1. // gstg.cpp : Defines the initialization routines for the DLL.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "gstg.h"
  6.  
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. //
  14. //    Note!
  15. //
  16. //        If this DLL is dynamically linked against the MFC
  17. //        DLLs, any functions exported from this DLL which
  18. //        call into MFC must have the AFX_MANAGE_STATE macro
  19. //        added at the very beginning of the function.
  20. //
  21. //        For example:
  22. //
  23. //        extern "C" BOOL PASCAL EXPORT ExportedFunction()
  24. //        {
  25. //            AFX_MANAGE_STATE(AfxGetStaticModuleState());
  26. //            // normal function body here
  27. //        }
  28. //
  29. //        It is very important that this macro appear in each
  30. //        function, prior to any calls into MFC.  This means that
  31. //        it must appear as the first statement within the 
  32. //        function, even before any object variable declarations
  33. //        as their constructors may generate calls into the MFC
  34. //        DLL.
  35. //
  36. //        Please see MFC Technical Notes 33 and 58 for additional
  37. //        details.
  38. //
  39.  
  40. /////////////////////////////////////////////////////////////////////////////
  41. // CGstgApp
  42.  
  43. BEGIN_MESSAGE_MAP(CGstgApp, CWinApp)
  44.     //{{AFX_MSG_MAP(CGstgApp)
  45.         // NOTE - the ClassWizard will add and remove mapping macros here.
  46.         //    DO NOT EDIT what you see in these blocks of generated code!
  47.     //}}AFX_MSG_MAP
  48. END_MESSAGE_MAP()
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CGstgApp construction
  52.  
  53. CGstgApp::CGstgApp()
  54. {
  55.     // TODO: add construction code here,
  56.     // Place all significant initialization in InitInstance
  57. }
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // The one and only CGstgApp object
  61.  
  62. CGstgApp theApp;
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CGstgApp initialization
  66.  
  67. BOOL CGstgApp::InitInstance()
  68. {
  69.     // Register all OLE server (factories) as running.  This enables the
  70.     //  OLE libraries to create objects from other applications.
  71.     COleObjectFactory::RegisterAll();
  72.  
  73.     return TRUE;
  74. }
  75.  
  76. /////////////////////////////////////////////////////////////////////////////
  77. // Special entry points required for inproc servers
  78.  
  79. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  80. {
  81.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  82.     return AfxDllGetClassObject(rclsid, riid, ppv);
  83. }
  84.  
  85. STDAPI DllCanUnloadNow(void)
  86. {
  87.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  88.     return AfxDllCanUnloadNow();
  89. }
  90.  
  91. // by exporting DllRegisterServer, you can use regsvr.exe
  92. STDAPI DllRegisterServer(void)
  93. {
  94.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  95.     COleObjectFactory::UpdateRegistryAll();
  96.     return S_OK;
  97. }
  98.