home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / catlsmpl.cpp < prev    next >
C/C++ Source or Header  |  1997-10-25  |  2KB  |  78 lines

  1. // CATLSmpl.cpp : Implementation of DLL Exports.
  2.  
  3. // You will need the NT SUR Beta 2 SDK or VC 4.2 in order to build this 
  4. // project.  This is because you will need MIDL 3.00.15 or higher and new
  5. // headers and libs.  If you have VC 4.2 installed, then everything should
  6. // already be configured correctly.
  7.  
  8. // Note: Proxy/Stub Information
  9. //        To build a separate proxy/stub DLL, 
  10. //        run nmake -f CATLSmplps.mak in the project directory.
  11.  
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "initguid.h"
  15. #include "CATLSmpl.h"
  16. #include "Simple.h"
  17.  
  18. #define IID_DEFINED
  19. #include "CATLSmpl_i.c"
  20.  
  21.  
  22. CComModule _Module;
  23.  
  24. BEGIN_OBJECT_MAP(ObjectMap)
  25.     OBJECT_ENTRY(CLSID_CSimple, CSimple)
  26. END_OBJECT_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // DLL Entry Point
  30.  
  31. extern "C"
  32. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  33. {
  34.     if (dwReason == DLL_PROCESS_ATTACH)
  35.     {
  36.         _Module.Init(ObjectMap, hInstance);
  37.         DisableThreadLibraryCalls(hInstance);
  38.     }
  39.     else if (dwReason == DLL_PROCESS_DETACH)
  40.         _Module.Term();
  41.     return TRUE;    // ok
  42. }
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // Used to determine whether the DLL can be unloaded by OLE
  46.  
  47. STDAPI DllCanUnloadNow(void)
  48. {
  49.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // Returns a class factory to create an object of the requested type
  54.  
  55. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  56. {
  57.     return _Module.GetClassObject(rclsid, riid, ppv);
  58. }
  59.  
  60. /////////////////////////////////////////////////////////////////////////////
  61. // DllRegisterServer - Adds entries to the system registry
  62.  
  63. STDAPI DllRegisterServer(void)
  64. {
  65.     // registers object, typelib and all interfaces in typelib
  66.     return _Module.RegisterServer(TRUE);
  67. }
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70. // DllUnregisterServer - Removes entries from the system registry
  71.  
  72. STDAPI DllUnregisterServer(void)
  73. {
  74.     _Module.UnregisterServer();
  75.     return S_OK;
  76. }
  77.  
  78.