prevband.cpp
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 2k
Category:

Windows Kernel

Development Platform:

Visual C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Copyright (C) Microsoft, 1997
  4. //
  5. //  File:       PrevBand.cpp
  6. //
  7. //  Contents:   Implementation of DLL Exports
  8. //
  9. //  History:    7-24-97  Davepl  Created
  10. //
  11. //--------------------------------------------------------------------------
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include "initguid.h"
  15. #include "PrevBand.h"
  16. #include "PrevBand_i.c"
  17. #include "PreviewBand.h"
  18. // Proxy/Stub Information:
  19. // To build a separate proxy/stub DLL, 
  20. // run nmake -f PrevBandps.mk in the project directory.
  21. // The one and only CComModule object
  22. CComModule _Module;
  23. BEGIN_OBJECT_MAP(ObjectMap)
  24. OBJECT_ENTRY(CLSID_PreviewBand, CPreviewBand)
  25. END_OBJECT_MAP()
  26. // DllMain
  27. //
  28. // DLL Entry Point
  29. extern "C"
  30. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  31. {
  32. if (dwReason == DLL_PROCESS_ATTACH)
  33. {
  34. _Module.Init(ObjectMap, hInstance);
  35. DisableThreadLibraryCalls(hInstance);
  36. }
  37. else if (dwReason == DLL_PROCESS_DETACH)
  38. _Module.Term();
  39. return TRUE;    // ok
  40. }
  41. // DllCanUnloadNow 
  42. //
  43. // Used to determine whether the DLL can be unloaded by OLE
  44. STDAPI DllCanUnloadNow(void)
  45. {
  46. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  47. }
  48. // DllGetClassObject
  49. //
  50. // Returns a class factory to create an object of the requested type
  51. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  52. {
  53. return _Module.GetClassObject(rclsid, riid, ppv);
  54. }
  55. // DllRegisterServer 
  56. //
  57. // Adds entries to the system registry
  58. STDAPI DllRegisterServer(void)
  59. {
  60.     // Registers object, typelib and all interfaces in typelib
  61.     return _Module.RegisterServer(TRUE);
  62. }
  63. // DllUnregisterServer 
  64. //
  65. // Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. _Module.UnregisterServer();
  69. return S_OK;
  70. }