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

  1. // ATLFire.cpp : Implementation of DLL Exports.
  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. // Note: Proxy/Stub Information
  14. //      To build a separate proxy/stub DLL,
  15. //      run nmake -f ATLFireps.mk in the project directory.
  16.  
  17. #include "stdafx.h"
  18. #include "resource.h"
  19. #include "initguid.h"
  20. #include "ATLFire.h"
  21.  
  22. #include "ATLFire_i.c"
  23. #include "FireTabCtrl.h"
  24.  
  25.  
  26. CComModule _Module;
  27.  
  28. BEGIN_OBJECT_MAP(ObjectMap)
  29.     OBJECT_ENTRY(CLSID_FireTabCtrl, CFireTabCtrl)
  30. END_OBJECT_MAP()
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // DLL Entry Point
  34.  
  35. extern "C"
  36. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  37. {
  38.     if (dwReason == DLL_PROCESS_ATTACH)
  39.     {
  40.         _Module.Init(ObjectMap, hInstance);
  41.         DisableThreadLibraryCalls(hInstance);
  42.     }
  43.     else if (dwReason == DLL_PROCESS_DETACH)
  44.         _Module.Term();
  45.     return TRUE;    // ok
  46. }
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49. // Used to determine whether the DLL can be unloaded by OLE
  50.  
  51. STDAPI DllCanUnloadNow(void)
  52. {
  53.     return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  54. }
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // Returns a class factory to create an object of the requested type
  58.  
  59. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  60. {
  61.     return _Module.GetClassObject(rclsid, riid, ppv);
  62. }
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllRegisterServer - Adds entries to the system registry
  66.  
  67. STDAPI DllRegisterServer(void)
  68. {
  69.     // registers object, typelib and all interfaces in typelib
  70.     return _Module.RegisterServer(TRUE);
  71. }
  72.  
  73. /////////////////////////////////////////////////////////////////////////////
  74. // DllUnregisterServer - Removes entries from the system registry
  75.  
  76. STDAPI DllUnregisterServer(void)
  77. {
  78.     _Module.UnregisterServer();
  79.     return S_OK;
  80. }
  81.