home *** CD-ROM | disk | FTP | other *** search
- // lst44.cpp : Implementation of DLL Exports.
-
- // To fully complete this project follow these steps
-
-
- // 1) Add a custom build step to lst44.idl
- // You can select all of the .IDL files by holding Ctrl and clicking on
- // each of them.
- //
- // Description
- // Running MIDL
- // Build Command(s)
- // midl /ms_ext /c_ext lst44.idl
- // Outputs
- // lst44.h
- // lst44_i.c
- //
-
- // 2) Add a custom build step to the project to register the DLL
- // For this, you can select all projects at once
- // Description
- // Registering OLE Server...
- // Build Command(s)
- // regsvr32 /s /c "$(TargetPath)"
- // echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
- // Outputs
- // $(OutDir)\regsvr32.trg
-
- // 3) To add UNICODE support, follow these steps
- // Select Build|Configurations...
- // Press Add...
- // Change the configuration name to Unicode Release
- // Change the "Copy Settings From" combo to lst44 - Win32 Release
- // Press OK
- // Press Add...
- // Change the configuration name to Unicode Debug
- // Change the "Copy Settings From" combo to lst44 - Win32 Debug
- // Press OK
- // Press "Close"
- // Select Build|Settings...
- // Select the two UNICODE projects and press the C++ tab.
- // Select the "General" category
- // Add _UNICODE to the Preprocessor definitions
- // Select the Unicode Debug project
- // Press the "General" tab
- // Specify DebugU for the intermediate and output directories
- // Select the Unicode Release project
- // Press the "General" tab
- // Specify ReleaseU for the intermediate and output directories
-
- // 4) Proxy stub DLL
- // To build a separate proxy/stub DLL,
- // run nmake -f ps.mak in the project directory.
-
- #include "stdafx.h"
- #include "resource.h"
- #include "initguid.h"
- #include "lst44.h"
- #include "Lst44Obj.h"
-
- #define IID_DEFINED
- #include "lst44_i.c"
-
- //These are declared in stdafx.h
- const IID LIBID_LST44Lib = { 0xc566cc20, 0x182e, 0x11d0, { 0xa6, 0xad, 0, 0xaa, 0, 0x60, 0x25, 0x53 } };
- const CLSID CLSID_Lst44 = { 0xc566cc25, 0x182e, 0x11d0, { 0xa6, 0xad, 0, 0xaa, 0, 0x60, 0x25, 0x53 } };
-
- CComModule _Module;
-
- BEGIN_OBJECT_MAP(ObjectMap)
- OBJECT_ENTRY(CLSID_Lst44, CLst44Object, "LST44.Lst44Object.1", "LST44.Lst44Object.1", IDS_LST44_DESC, THREADFLAGS_BOTH)
- END_OBJECT_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // DLL Entry Point
-
- extern "C"
- BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
- {
- if (dwReason == DLL_PROCESS_ATTACH)
- {
- _Module.Init(ObjectMap, hInstance);
- DisableThreadLibraryCalls(hInstance);
- }
- else if (dwReason == DLL_PROCESS_DETACH)
- _Module.Term();
- return TRUE; // ok
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Used to determine whether the DLL can be unloaded by OLE
-
- STDAPI DllCanUnloadNow(void)
- {
- return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Returns a class factory to create an object of the requested type
-
- STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
- {
- return _Module.GetClassObject(rclsid, riid, ppv);
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // DllRegisterServer - Adds entries to the system registry
-
- STDAPI DllRegisterServer(void)
- {
- HRESULT hRes = S_OK;
- // registers object, typelib and all interfaces in typelib
- hRes = _Module.UpdateRegistry(TRUE);
- return hRes;
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // DllUnregisterServer - Adds entries to the system registry
-
- STDAPI DllUnregisterServer(void)
- {
- HRESULT hRes = S_OK;
- _Module.RemoveRegistry();
- return hRes;
- }
-