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