1*520fa265SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
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 
22*520fa265SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir // Note: Proxy/Stub Information
26cdf0e10cSrcweir //      To build a separate proxy/stub DLL,
27cdf0e10cSrcweir //      run nmake -f AxTestComponentsps.mk in the project directory.
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "stdafx.h"
30cdf0e10cSrcweir #include "resource.h"
31cdf0e10cSrcweir #include <initguid.h>
32cdf0e10cSrcweir //#include "AxTestComponents.h"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //#include "AxTestComponents_i.c"
35cdf0e10cSrcweir #include "Basic.h"
36cdf0e10cSrcweir #include "Foo.h"
37cdf0e10cSrcweir 
38cdf0e10cSrcweir 
39cdf0e10cSrcweir CComModule _Module;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Basic,CBasic)42cdf0e10cSrcweir OBJECT_ENTRY(CLSID_Basic, CBasic)
43cdf0e10cSrcweir OBJECT_ENTRY(CLSID_Foo, CFoo)
44cdf0e10cSrcweir END_OBJECT_MAP()
45cdf0e10cSrcweir 
46cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
47cdf0e10cSrcweir // DLL Entry Point
48cdf0e10cSrcweir 
49cdf0e10cSrcweir extern "C"
50cdf0e10cSrcweir BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir     if (dwReason == DLL_PROCESS_ATTACH)
53cdf0e10cSrcweir     {
54cdf0e10cSrcweir         _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib);
55cdf0e10cSrcweir         DisableThreadLibraryCalls(hInstance);
56cdf0e10cSrcweir     }
57cdf0e10cSrcweir     else if (dwReason == DLL_PROCESS_DETACH)
58cdf0e10cSrcweir         _Module.Term();
59cdf0e10cSrcweir     return TRUE;    // ok
60cdf0e10cSrcweir }
61cdf0e10cSrcweir 
62cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
63cdf0e10cSrcweir // Used to determine whether the DLL can be unloaded by OLE
64cdf0e10cSrcweir 
DllCanUnloadNow(void)65cdf0e10cSrcweir STDAPI DllCanUnloadNow(void)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
68cdf0e10cSrcweir }
69cdf0e10cSrcweir 
70cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
71cdf0e10cSrcweir // Returns a class factory to create an object of the requested type
72cdf0e10cSrcweir 
DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)73cdf0e10cSrcweir STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
74cdf0e10cSrcweir {
75cdf0e10cSrcweir     return _Module.GetClassObject(rclsid, riid, ppv);
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
79cdf0e10cSrcweir // DllRegisterServer - Adds entries to the system registry
80cdf0e10cSrcweir 
DllRegisterServer(void)81cdf0e10cSrcweir STDAPI DllRegisterServer(void)
82cdf0e10cSrcweir {
83cdf0e10cSrcweir     // registers object, typelib and all interfaces in typelib
84cdf0e10cSrcweir     return _Module.RegisterServer(TRUE);
85cdf0e10cSrcweir }
86cdf0e10cSrcweir 
87cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////////////
88cdf0e10cSrcweir // DllUnregisterServer - Removes entries from the system registry
89cdf0e10cSrcweir 
DllUnregisterServer(void)90cdf0e10cSrcweir STDAPI DllUnregisterServer(void)
91cdf0e10cSrcweir {
92cdf0e10cSrcweir     return _Module.UnregisterServer(TRUE);
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 
96cdf0e10cSrcweir //VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED