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