home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / atl / circ / circprops.cpp < prev    next >
C/C++ Source or Header  |  1998-03-26  |  2KB  |  74 lines

  1. // circprops.cpp : circ properties
  2. //
  3. // This is a part of the Active Template Library.
  4. // Copyright (C) 1996-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Active Template Library Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Active Template Library product.
  12.  
  13. #include "stdafx.h"
  14. #include "circProps.h"
  15.  
  16. const GUID CLSID_CCircProps =
  17. { 0x47536f96, 0xf610, 0x11cf, { 0x91, 0xf0, 0x0, 0xa0, 0xc9, 0x3, 0x97, 0x7f } };
  18.  
  19. CComModule _Module;
  20.  
  21. BEGIN_OBJECT_MAP(ObjectMap)
  22.     OBJECT_ENTRY(CLSID_CCircProps, CCircProps)
  23. END_OBJECT_MAP()
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // DLL Entry Point
  27.  
  28. extern "C"
  29. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  30. {
  31.     if (dwReason == DLL_PROCESS_ATTACH)
  32.     {
  33.         _Module.Init(ObjectMap, hInstance);
  34.         DisableThreadLibraryCalls(hInstance);
  35.     }
  36.     else if (dwReason == DLL_PROCESS_DETACH)
  37.         _Module.Term();
  38.     return TRUE;    // ok
  39. }
  40.  
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Used to determine whether the DLL can be unloaded by OLE
  43.  
  44. STDAPI DllCanUnloadNow(void)
  45. {
  46.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  47. }
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // Returns a class factory to create an object of the requested type
  51.  
  52. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  53. {
  54.     return _Module.GetClassObject(rclsid, riid, ppv);
  55. }
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59.  
  60. STDAPI DllRegisterServer(void)
  61. {
  62.     // registers object, typelib and all interfaces in typelib
  63.     return _Module.RegisterServer(FALSE);
  64. }
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // DllUnregisterServer - Removes entries from the system registry
  68.  
  69. STDAPI DllUnregisterServer(void)
  70. {
  71.     _Module.UnregisterServer();
  72.     return S_OK;
  73. }
  74.