MyPassword.h
上传用户:weisheen
上传日期:2022-07-09
资源大小:19390k
文件大小:4k
源码类别:
ActiveX/DCOM/ATL
开发平台:
Visual C++
- // MyPassword.h : Declaration of the CMyPassword
- #ifndef __MYPASSWORD_H_
- #define __MYPASSWORD_H_
- #include "resource.h" // main symbols
- #include <atlctl.h>
- #include "MyControlCP.h"
- /////////////////////////////////////////////////////////////////////////////
- // CMyPassword
- class ATL_NO_VTABLE CMyPassword :
- public CComObjectRootEx<CComSingleThreadModel>,
- public IDispatchImpl<IMyPassword, &IID_IMyPassword, &LIBID_MYCONTROLLib>,
- public CComCompositeControl<CMyPassword>,
- public IPersistStreamInitImpl<CMyPassword>,
- public IOleControlImpl<CMyPassword>,
- public IOleObjectImpl<CMyPassword>,
- public IOleInPlaceActiveObjectImpl<CMyPassword>,
- public IViewObjectExImpl<CMyPassword>,
- public IOleInPlaceObjectWindowlessImpl<CMyPassword>,
- public IConnectionPointContainerImpl<CMyPassword>,
- public IPersistStorageImpl<CMyPassword>,
- public ISpecifyPropertyPagesImpl<CMyPassword>,
- public IQuickActivateImpl<CMyPassword>,
- public IDataObjectImpl<CMyPassword>,
- public IProvideClassInfo2Impl<&CLSID_MyPassword, &DIID__IMyPasswordEvents, &LIBID_MYCONTROLLib>,
- public IPropertyNotifySinkCP<CMyPassword>,
- public CComCoClass<CMyPassword, &CLSID_MyPassword>,
- public CProxy_IMyPasswordEvents< CMyPassword >
- {
- public:
- CMyPassword()
- {
- m_bWindowOnly = TRUE;
- CalcExtent(m_sizeExtent);
- }
- DECLARE_REGISTRY_RESOURCEID(IDR_MYPASSWORD)
- DECLARE_PROTECT_FINAL_CONSTRUCT()
- BEGIN_COM_MAP(CMyPassword)
- COM_INTERFACE_ENTRY(IMyPassword)
- COM_INTERFACE_ENTRY(IDispatch)
- COM_INTERFACE_ENTRY(IViewObjectEx)
- COM_INTERFACE_ENTRY(IViewObject2)
- COM_INTERFACE_ENTRY(IViewObject)
- COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
- COM_INTERFACE_ENTRY(IOleInPlaceObject)
- COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
- COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
- COM_INTERFACE_ENTRY(IOleControl)
- COM_INTERFACE_ENTRY(IOleObject)
- COM_INTERFACE_ENTRY(IPersistStreamInit)
- COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
- COM_INTERFACE_ENTRY(IConnectionPointContainer)
- COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
- COM_INTERFACE_ENTRY(IQuickActivate)
- COM_INTERFACE_ENTRY(IPersistStorage)
- COM_INTERFACE_ENTRY(IDataObject)
- COM_INTERFACE_ENTRY(IProvideClassInfo)
- COM_INTERFACE_ENTRY(IProvideClassInfo2)
- COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
- END_COM_MAP()
- BEGIN_PROP_MAP(CMyPassword)
- PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
- PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
- // Example entries
- // PROP_ENTRY("Property Description", dispid, clsid)
- // PROP_PAGE(CLSID_StockColorPage)
- END_PROP_MAP()
- BEGIN_CONNECTION_POINT_MAP(CMyPassword)
- CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
- CONNECTION_POINT_ENTRY(DIID__IMyPasswordEvents)
- END_CONNECTION_POINT_MAP()
- BEGIN_MSG_MAP(CMyPassword)
- CHAIN_MSG_MAP(CComCompositeControl<CMyPassword>)
- COMMAND_HANDLER(IDC_BUTTON1, BN_CLICKED, OnClickedButton1)
- END_MSG_MAP()
- // Handler prototypes:
- // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
- // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
- // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
- BEGIN_SINK_MAP(CMyPassword)
- //Make sure the Event Handlers have __stdcall calling convention
- END_SINK_MAP()
- STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
- {
- if (dispid == DISPID_AMBIENT_BACKCOLOR)
- {
- SetBackgroundColorFromAmbient();
- FireViewChange();
- }
- return IOleControlImpl<CMyPassword>::OnAmbientPropertyChange(dispid);
- }
- // IViewObjectEx
- DECLARE_VIEW_STATUS(0)
- // IMyPassword
- public:
- enum { IDD = IDD_MYPASSWORD };
- LRESULT OnClickedButton1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled)
- {
- // TODO : Add Code for control notification handler.
- this->Fire_show(::SysAllocString(L"asdf")); return 0;
- }
- };
- #endif //__MYPASSWORD_H_