Back to index

lightning-sunbird  0.9+nobinonly
XPCIDispatchTest.cpp
Go to the documentation of this file.
00001 // XPCIDispatchTest.cpp : Implementation of DLL Exports.
00002 
00003 
00004 // Note: Proxy/Stub Information
00005 //      To build a separate proxy/stub DLL, 
00006 //      run nmake -f IDispatchTestps.mk in the project directory.
00007 
00008 #include "stdafx.h"
00009 #include "resource.h"
00010 #include <initguid.h>
00011 #include "XPCIDispatchTest.h"
00012 
00013 #include "XPCIDispatchTest_i.c"
00014 #include "nsXPCDispTestMethods.h"
00015 #include "nsXPCDispSimple.h"
00016 #include "nsXPCDispTestNoIDispatch.h"
00017 #include "nsXPCDispTestProperties.h"
00018 #include "nsXPCDispTestArrays.h"
00019 #include "nsXPCDispTestScriptOn.h"
00020 #include "nsXPCDispTestScriptOff.h"
00021 #include "nsXPCDispTestWrappedJS.h"
00022 
00023 CComModule _Module;
00024 
00025 BEGIN_OBJECT_MAP(ObjectMap)
00026 OBJECT_ENTRY(CLSID_nsXPCDispTestMethods, nsXPCDispTestMethods)
00027 OBJECT_ENTRY(CLSID_nsXPCDispSimple, nsXPCDispSimple)
00028 OBJECT_ENTRY(CLSID_nsXPCDispTestNoIDispatch, nsXPCDispTestNoIDispatch)
00029 OBJECT_ENTRY(CLSID_nsXPCDispTestProperties, nsXPCDispTestProperties)
00030 OBJECT_ENTRY(CLSID_nsXPCDispTestArrays, nsXPCDispTestArrays)
00031 OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOn, nsXPCDispTestScriptOn)
00032 OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOff, nsXPCDispTestScriptOff)
00033 OBJECT_ENTRY(CLSID_nsXPCDispTestWrappedJS, nsXPCDispTestWrappedJS)
00034 END_OBJECT_MAP()
00035 
00037 // DLL Entry Point
00038 
00039 extern "C"
00040 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
00041 {
00042     if (dwReason == DLL_PROCESS_ATTACH)
00043     {
00044         _Module.Init(ObjectMap, hInstance, &LIBID_IDispatchTestLib);
00045         DisableThreadLibraryCalls(hInstance);
00046     }
00047     else if (dwReason == DLL_PROCESS_DETACH)
00048         _Module.Term();
00049     return TRUE;    // ok
00050 }
00051 
00053 // Used to determine whether the DLL can be unloaded by OLE
00054 
00055 STDAPI DllCanUnloadNow(void)
00056 {
00057     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
00058 }
00059 
00061 // Returns a class factory to create an object of the requested type
00062 
00063 STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
00064 {
00065     return _Module.GetClassObject(rclsid, riid, ppv);
00066 }
00067 
00069 // DllRegisterServer - Adds entries to the system registry
00070 
00071 STDAPI DllRegisterServer(void)
00072 {
00073     // registers object, typelib and all interfaces in typelib
00074     return _Module.RegisterServer(TRUE);
00075 }
00076 
00078 // DllUnregisterServer - Removes entries from the system registry
00079 
00080 STDAPI DllUnregisterServer(void)
00081 {
00082     return _Module.UnregisterServer(TRUE);
00083 }
00084 
00085 
00086 #include "nsXPCDispTestWrappedJS.h"