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

ActiveX/DCOM/ATL

开发平台:

Visual C++

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