home *** CD-ROM | disk | FTP | other *** search
/ Building OCXs / Building_OCXs_Que_1995.iso / code / ch09 / comm.cpp < prev    next >
C/C++ Source or Header  |  1994-12-11  |  2KB  |  79 lines

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