home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / samples / c12 / simpledual / simple.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.8 KB  |  77 lines

  1. // Simple.cpp : Implementation of CSimpleApp and DLL registration.
  2.  
  3. #include "stdafx.h"
  4. #include "Simple.h"
  5.  
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11.  
  12.  
  13. CSimpleApp NEAR theApp;
  14.  
  15. const GUID CDECL BASED_CODE _tlid =
  16.         { 0xc48a81e0, 0x4384, 0x11d0, { 0x9c, 0x9d, 0, 0, 0, 0, 0, 0 } };
  17. const WORD _wVerMajor = 1;
  18. const WORD _wVerMinor = 0;
  19.  
  20.  
  21. ////////////////////////////////////////////////////////////////////////////
  22. // CSimpleApp::InitInstance - DLL initialization
  23.  
  24. BOOL CSimpleApp::InitInstance()
  25. {
  26.     BOOL bInit = COleControlModule::InitInstance();
  27.  
  28.     if (bInit)
  29.     {
  30.     }
  31.  
  32.     return bInit;
  33. }
  34.  
  35.  
  36. ////////////////////////////////////////////////////////////////////////////
  37. // CSimpleApp::ExitInstance - DLL termination
  38.  
  39. int CSimpleApp::ExitInstance()
  40. {
  41.     return COleControlModule::ExitInstance();
  42. }
  43.  
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DllRegisterServer - Adds entries to the system registry
  47.  
  48. STDAPI DllRegisterServer(void)
  49. {
  50.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  51.  
  52.     if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  53.         return ResultFromScode(SELFREG_E_TYPELIB);
  54.  
  55.     if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
  56.         return ResultFromScode(SELFREG_E_CLASS);
  57.  
  58.     return NOERROR;
  59. }
  60.  
  61.  
  62. /////////////////////////////////////////////////////////////////////////////
  63. // DllUnregisterServer - Removes entries from the system registry
  64.  
  65. STDAPI DllUnregisterServer(void)
  66. {
  67.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  68.  
  69.     if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
  70.         return ResultFromScode(SELFREG_E_TYPELIB);
  71.  
  72.     if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
  73.         return ResultFromScode(SELFREG_E_CLASS);
  74.  
  75.     return NOERROR;
  76. }
  77.