home *** CD-ROM | disk | FTP | other *** search
/ Mastering MFC Development / MMD.ISO / labs / c12 / lab01 / ex01 / palview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-20  |  1.9 KB  |  81 lines

  1. // PalView.cpp : Implementation of CPalViewApp and DLL registration.
  2.  
  3. #include "stdafx.h"
  4. #include "PalView.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. CPalViewApp NEAR theApp;
  14.  
  15. const GUID CDECL BASED_CODE _tlid =
  16.         { 0x7f7767c0, 0x365b, 0x11d0, 
  17.         { 0x9c, 0x9d, 0, 0xa0, 0xd1, 0, 0xe3, 0xc8 } };
  18. const WORD _wVerMajor = 1;
  19. const WORD _wVerMinor = 0;
  20.  
  21.  
  22. ////////////////////////////////////////////////////////////////////////////
  23. // CPalViewApp::InitInstance - DLL initialization
  24.  
  25. BOOL CPalViewApp::InitInstance()
  26. {
  27.     BOOL bInit = COleControlModule::InitInstance();
  28.  
  29.     if (bInit)
  30.     {
  31.         // TODO: Add your own module initialization code here.
  32.     }
  33.  
  34.     return bInit;
  35. }
  36.  
  37.  
  38. ////////////////////////////////////////////////////////////////////////////
  39. // CPalViewApp::ExitInstance - DLL termination
  40.  
  41. int CPalViewApp::ExitInstance()
  42. {
  43.     // TODO: Add your own module termination code here.
  44.  
  45.     return COleControlModule::ExitInstance();
  46. }
  47.  
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // DllRegisterServer - Adds entries to the system registry
  51.  
  52. STDAPI DllRegisterServer(void)
  53. {
  54.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  55.  
  56.     if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
  57.         return ResultFromScode(SELFREG_E_TYPELIB);
  58.  
  59.     if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
  60.         return ResultFromScode(SELFREG_E_CLASS);
  61.  
  62.     return NOERROR;
  63. }
  64.  
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // DllUnregisterServer - Removes entries from the system registry
  68.  
  69. STDAPI DllUnregisterServer(void)
  70. {
  71.     AFX_MANAGE_STATE(_afxModuleAddrThis);
  72.  
  73.     if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
  74.         return ResultFromScode(SELFREG_E_TYPELIB);
  75.  
  76.     if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
  77.         return ResultFromScode(SELFREG_E_CLASS);
  78.  
  79.     return NOERROR;
  80. }
  81.