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