Back to index

plt-scheme  4.2.1
testobject.cxx
Go to the documentation of this file.
00001 // testobject.cpp : Implementation of DLL Exports.
00002 
00003 
00004 // Note: Proxy/Stub Information
00005 //      To build a separate proxy/stub DLL,
00006 //      run nmake -f testobjectps.mk in the project directory.
00007 
00008 #include "stdafx.h"
00009 #include "resource.h"
00010 #include <initguid.h>
00011 #include "testobject.h"
00012 
00013 #include "testobject_i.c"
00014 #include "TestControl.h"
00015 
00016 
00017 CComModule _Module;
00018 
00019 BEGIN_OBJECT_MAP(ObjectMap)
00020 OBJECT_ENTRY(CLSID_TestControl, CTestControl)
00021 END_OBJECT_MAP()
00022 
00024 // DLL Entry Point
00025 
00026 extern "C"
00027 BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
00028 {
00029   if (dwReason == DLL_PROCESS_ATTACH) {
00030       _Module.Init (ObjectMap, hInstance, &LIBID_TESTOBJECTLib);
00031       DisableThreadLibraryCalls (hInstance);
00032       }
00033   else if (dwReason == DLL_PROCESS_DETACH)
00034       _Module.Term();
00035   return TRUE;    // ok
00036 }
00037 
00039 // Used to determine whether the DLL can be unloaded by OLE
00040 
00041 STDAPI DllCanUnloadNow (void)
00042 {
00043   return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
00044 }
00045 
00047 // Returns a class factory to create an object of the requested type
00048 
00049 STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID* ppv)
00050 {
00051   return _Module.GetClassObject (rclsid, riid, ppv);
00052 }
00053 
00055 // DllRegisterServer - Adds entries to the system registry
00056 
00057 STDAPI DllRegisterServer (void)
00058 {
00059   // registers object, typelib and all interfaces in typelib
00060   return _Module.RegisterServer (TRUE);
00061 }
00062 
00064 // DllUnregisterServer - Removes entries from the system registry
00065 
00066 STDAPI DllUnregisterServer (void)
00067 {
00068   return _Module.UnregisterServer (TRUE);
00069 }
00070 
00071