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

  1. // CompCtrl.cpp : Implementation of DLL Exports.
  2.  
  3.  
  4. // Note: Proxy/Stub Information
  5. //        To build a separate proxy/stub DLL, 
  6. //        run nmake -f CompCtrlps.mk in the project directory.
  7.  
  8. #include "stdafx.h"
  9. #include "resource.h"
  10. #include "initguid.h"
  11. #include "CompCtrl.h"
  12.  
  13. #include "CompCtrl_i.c"
  14. #include "CComCtrl.h"
  15.  
  16.  
  17. CComModule _Module;
  18.  
  19. BEGIN_OBJECT_MAP(ObjectMap)
  20.     OBJECT_ENTRY(CLSID_CComCtrl, CComCtrl)
  21. END_OBJECT_MAP()
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // DLL Entry Point
  25.  
  26. extern "C"
  27. BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  28. {
  29.     if (dwReason == DLL_PROCESS_ATTACH)
  30.     {
  31.         _Module.Init(ObjectMap, (HINSTANCE)hInstance);
  32. #ifndef UNDER_CE
  33.         DisableThreadLibraryCalls((HINSTANCE)hInstance);
  34. #endif
  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(TRUE);
  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.  
  75.  
  76.