xref: /AOO41X/main/extensions/test/ole/MfcControl/MfcControl.cpp (revision 520fa26520b0e796579cd98364c4c8e80094d346)
1*520fa265SAndrew Rist /**************************************************************
2*520fa265SAndrew Rist  *
3*520fa265SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*520fa265SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*520fa265SAndrew Rist  * distributed with this work for additional information
6*520fa265SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*520fa265SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*520fa265SAndrew Rist  * "License"); you may not use this file except in compliance
9*520fa265SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*520fa265SAndrew Rist  *
11*520fa265SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*520fa265SAndrew Rist  *
13*520fa265SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*520fa265SAndrew Rist  * software distributed under the License is distributed on an
15*520fa265SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*520fa265SAndrew Rist  * KIND, either express or implied.  See the License for the
17*520fa265SAndrew Rist  * specific language governing permissions and limitations
18*520fa265SAndrew Rist  * under the License.
19*520fa265SAndrew Rist  *
20*520fa265SAndrew Rist  *************************************************************/
21*520fa265SAndrew Rist 
22cdf0e10cSrcweir // MfcControl.cpp : Implementation of CMfcControlApp and DLL registration.
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "stdafx.h"
25cdf0e10cSrcweir #include "MfcControl.h"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifdef _DEBUG
28cdf0e10cSrcweir #define new DEBUG_NEW
29cdf0e10cSrcweir #undef THIS_FILE
30cdf0e10cSrcweir static char THIS_FILE[] = __FILE__;
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir 
34cdf0e10cSrcweir CMfcControlApp NEAR theApp;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir const GUID CDECL BASED_CODE _tlid =
37cdf0e10cSrcweir 		{ 0xac221fb3, 0xa0d8, 0x11d4, { 0x83, 0x3b, 0, 0x50, 0x4, 0x52, 0x6a, 0xb4 } };
38cdf0e10cSrcweir const WORD _wVerMajor = 1;
39cdf0e10cSrcweir const WORD _wVerMinor = 0;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////
43cdf0e10cSrcweir // CMfcControlApp::InitInstance - DLL initialization
44cdf0e10cSrcweir 
InitInstance()45cdf0e10cSrcweir BOOL CMfcControlApp::InitInstance()
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	BOOL bInit = COleControlModule::InitInstance();
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 	if (bInit)
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir 		// TODO: Add your own module initialization code here.
52cdf0e10cSrcweir 	}
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	return bInit;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 
58cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////
59cdf0e10cSrcweir // CMfcControlApp::ExitInstance - DLL termination
60cdf0e10cSrcweir 
ExitInstance()61cdf0e10cSrcweir int CMfcControlApp::ExitInstance()
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 	// TODO: Add your own module termination code here.
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 	return COleControlModule::ExitInstance();
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 
69cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
70cdf0e10cSrcweir // DllRegisterServer - Adds entries to the system registry
71cdf0e10cSrcweir 
DllRegisterServer(void)72cdf0e10cSrcweir STDAPI DllRegisterServer(void)
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	AFX_MANAGE_STATE(_afxModuleAddrThis);
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	if (!AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid))
77cdf0e10cSrcweir 		return ResultFromScode(SELFREG_E_TYPELIB);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	if (!COleObjectFactoryEx::UpdateRegistryAll(TRUE))
80cdf0e10cSrcweir 		return ResultFromScode(SELFREG_E_CLASS);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	return NOERROR;
83cdf0e10cSrcweir }
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 
86cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
87cdf0e10cSrcweir // DllUnregisterServer - Removes entries from the system registry
88cdf0e10cSrcweir 
DllUnregisterServer(void)89cdf0e10cSrcweir STDAPI DllUnregisterServer(void)
90cdf0e10cSrcweir {
91cdf0e10cSrcweir 	AFX_MANAGE_STATE(_afxModuleAddrThis);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	if (!AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor))
94cdf0e10cSrcweir 		return ResultFromScode(SELFREG_E_TYPELIB);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	if (!COleObjectFactoryEx::UpdateRegistryAll(FALSE))
97cdf0e10cSrcweir 		return ResultFromScode(SELFREG_E_CLASS);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	return NOERROR;
100cdf0e10cSrcweir }
101