MyPassword.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:4k
源码类别:

ActiveX/DCOM/ATL

开发平台:

Visual C++

  1. // MyPassword.h : Declaration of the CMyPassword
  2. #ifndef __MYPASSWORD_H_
  3. #define __MYPASSWORD_H_
  4. #include "resource.h"       // main symbols
  5. #include <atlctl.h>
  6. #include "MyControlCP.h"
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CMyPassword
  9. class ATL_NO_VTABLE CMyPassword : 
  10. public CComObjectRootEx<CComSingleThreadModel>,
  11. public IDispatchImpl<IMyPassword, &IID_IMyPassword, &LIBID_MYCONTROLLib>,
  12. public CComCompositeControl<CMyPassword>,
  13. public IPersistStreamInitImpl<CMyPassword>,
  14. public IOleControlImpl<CMyPassword>,
  15. public IOleObjectImpl<CMyPassword>,
  16. public IOleInPlaceActiveObjectImpl<CMyPassword>,
  17. public IViewObjectExImpl<CMyPassword>,
  18. public IOleInPlaceObjectWindowlessImpl<CMyPassword>,
  19. public IConnectionPointContainerImpl<CMyPassword>,
  20. public IPersistStorageImpl<CMyPassword>,
  21. public ISpecifyPropertyPagesImpl<CMyPassword>,
  22. public IQuickActivateImpl<CMyPassword>,
  23. public IDataObjectImpl<CMyPassword>,
  24. public IProvideClassInfo2Impl<&CLSID_MyPassword, &DIID__IMyPasswordEvents, &LIBID_MYCONTROLLib>,
  25. public IPropertyNotifySinkCP<CMyPassword>,
  26. public CComCoClass<CMyPassword, &CLSID_MyPassword>,
  27. public CProxy_IMyPasswordEvents< CMyPassword >
  28. {
  29. public:
  30. CMyPassword()
  31. {
  32. m_bWindowOnly = TRUE;
  33. CalcExtent(m_sizeExtent);
  34. }
  35. DECLARE_REGISTRY_RESOURCEID(IDR_MYPASSWORD)
  36. DECLARE_PROTECT_FINAL_CONSTRUCT()
  37. BEGIN_COM_MAP(CMyPassword)
  38. COM_INTERFACE_ENTRY(IMyPassword)
  39. COM_INTERFACE_ENTRY(IDispatch)
  40. COM_INTERFACE_ENTRY(IViewObjectEx)
  41. COM_INTERFACE_ENTRY(IViewObject2)
  42. COM_INTERFACE_ENTRY(IViewObject)
  43. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  44. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  45. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  46. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  47. COM_INTERFACE_ENTRY(IOleControl)
  48. COM_INTERFACE_ENTRY(IOleObject)
  49. COM_INTERFACE_ENTRY(IPersistStreamInit)
  50. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  51. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  52. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  53. COM_INTERFACE_ENTRY(IQuickActivate)
  54. COM_INTERFACE_ENTRY(IPersistStorage)
  55. COM_INTERFACE_ENTRY(IDataObject)
  56. COM_INTERFACE_ENTRY(IProvideClassInfo)
  57. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  58. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  59. END_COM_MAP()
  60. BEGIN_PROP_MAP(CMyPassword)
  61. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  62. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  63. // Example entries
  64. // PROP_ENTRY("Property Description", dispid, clsid)
  65. // PROP_PAGE(CLSID_StockColorPage)
  66. END_PROP_MAP()
  67. BEGIN_CONNECTION_POINT_MAP(CMyPassword)
  68. CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
  69. CONNECTION_POINT_ENTRY(DIID__IMyPasswordEvents)
  70. END_CONNECTION_POINT_MAP()
  71. BEGIN_MSG_MAP(CMyPassword)
  72. CHAIN_MSG_MAP(CComCompositeControl<CMyPassword>)
  73. COMMAND_HANDLER(IDC_BUTTON1, BN_CLICKED, OnClickedButton1)
  74. END_MSG_MAP()
  75. // Handler prototypes:
  76. //  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  77. //  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  78. //  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  79. BEGIN_SINK_MAP(CMyPassword)
  80. //Make sure the Event Handlers have __stdcall calling convention
  81. END_SINK_MAP()
  82. STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
  83. {
  84. if (dispid == DISPID_AMBIENT_BACKCOLOR)
  85. {
  86. SetBackgroundColorFromAmbient();
  87. FireViewChange();
  88. }
  89. return IOleControlImpl<CMyPassword>::OnAmbientPropertyChange(dispid);
  90. }
  91. // IViewObjectEx
  92. DECLARE_VIEW_STATUS(0)
  93. // IMyPassword
  94. public:
  95. enum { IDD = IDD_MYPASSWORD };
  96. LRESULT OnClickedButton1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
  97. {
  98. // TODO : Add Code for control notification handler.
  99. this->Fire_show(::SysAllocString(L"asdf")); return 0;
  100. }
  101. };
  102. #endif //__MYPASSWORD_H_