home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / ATL_Samples / count / count.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  1.9 KB  |  78 lines

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