merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / test / ole / AxTestComponents / AxTestComponents.cpp
blob343b206d00851d290c47290cd575b5ccf783b7ef
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
29 // Note: Proxy/Stub Information
30 // To build a separate proxy/stub DLL,
31 // run nmake -f AxTestComponentsps.mk in the project directory.
33 #include "stdafx.h"
34 #include "resource.h"
35 #include <initguid.h>
36 //#include "AxTestComponents.h"
38 //#include "AxTestComponents_i.c"
39 #include "Basic.h"
40 #include "Foo.h"
43 CComModule _Module;
45 BEGIN_OBJECT_MAP(ObjectMap)
46 OBJECT_ENTRY(CLSID_Basic, CBasic)
47 OBJECT_ENTRY(CLSID_Foo, CFoo)
48 END_OBJECT_MAP()
50 /////////////////////////////////////////////////////////////////////////////
51 // DLL Entry Point
53 extern "C"
54 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
56 if (dwReason == DLL_PROCESS_ATTACH)
58 _Module.Init(ObjectMap, hInstance, &LIBID_AXTESTCOMPONENTSLib);
59 DisableThreadLibraryCalls(hInstance);
61 else if (dwReason == DLL_PROCESS_DETACH)
62 _Module.Term();
63 return TRUE; // ok
66 /////////////////////////////////////////////////////////////////////////////
67 // Used to determine whether the DLL can be unloaded by OLE
69 STDAPI DllCanUnloadNow(void)
71 return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
74 /////////////////////////////////////////////////////////////////////////////
75 // Returns a class factory to create an object of the requested type
77 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
79 return _Module.GetClassObject(rclsid, riid, ppv);
82 /////////////////////////////////////////////////////////////////////////////
83 // DllRegisterServer - Adds entries to the system registry
85 STDAPI DllRegisterServer(void)
87 // registers object, typelib and all interfaces in typelib
88 return _Module.RegisterServer(TRUE);
91 /////////////////////////////////////////////////////////////////////////////
92 // DllUnregisterServer - Removes entries from the system registry
94 STDAPI DllUnregisterServer(void)
96 return _Module.UnregisterServer(TRUE);
100 //VT_I4 size_t V_ERROR VARIANT VARIANT_FALSE CComVariant FADF_EMBEDDED