?? afxctl.h
字號:
// Window reparenting
virtual void ReparentControlWindow(HWND hWndOuter, HWND hWndParent);
// Window procedure
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
// General-purpose flags
enum ControlFlags {
fastBeginPaint = 0x0001,
clipPaintDC = 0x0002,
pointerInactive = 0x0004,
noFlickerActivate = 0x0008,
windowlessActivate = 0x0010,
canOptimizeDraw = 0x0020,
};
virtual DWORD GetControlFlags();
// Inactive pointer handling
virtual DWORD GetActivationPolicy();
virtual BOOL OnInactiveSetCursor(LPCRECT lprcBounds, long x, long y,
DWORD dwMouseMsg, BOOL bSetAlways);
virtual void OnInactiveMouseMove(LPCRECT lprcBounds, long x, long y,
DWORD dwKeyState);
// Windowless activation handling
virtual BOOL OnWindowlessMessage(UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT* plResult);
virtual IDropTarget* GetWindowlessDropTarget();
// Inactive/windowless helper functions
virtual void GetClientOffset(long* pdxOffset, long* pdyOffset) const;
virtual UINT ParentToClient(LPCRECT lprcBounds, LPPOINT pPoint,
BOOL bHitTest = FALSE) const;
virtual void ClientToParent(LPCRECT lprcBounds, LPPOINT pPoint) const;
// Asynchronous properties
void Load(LPCTSTR strNewPath, CDataPathProperty& prop);
// Implementation
public:
~COleControl();
void RequestAsynchronousExchange(DWORD dwVersion);
#ifdef _DEBUG
void AssertValid() const;
void Dump(CDumpContext& dc) const;
#endif // _DEBUG
protected:
// Friend classes
friend class COleControlInnerUnknown;
friend class CReflectorWnd;
friend class CControlFrameWnd;
// Interface hook for primary automation interface
LPUNKNOWN GetInterfaceHook(const void* piid);
// Shutdown
virtual void OnFinalRelease();
void ReleaseCaches();
// Window management
virtual BOOL CreateControlWindow(HWND hWndParent, const CRect& rcPos,
LPCRECT prcClipped = NULL);
void CreateWindowForSubclassedControl();
BOOL IgnoreWindowMessage(UINT msg, WPARAM wParam, LPARAM lParam,
LRESULT* plResult);
virtual LRESULT DefWindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
// Serialization
HRESULT SaveState(IStream* pStm);
HRESULT LoadState(IStream* pStm);
virtual void Serialize(CArchive& ar);
// Drawing
void DrawContent(CDC* pDC, CRect& rc);
void DrawMetafile(CDC* pDC, CRect& rc);
BOOL GetMetafileData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
// Implementation of IDataObject
// CControlDataSource implements OnRender reflections to COleControl
class CControlDataSource : public COleDataSource
{
public:
CControlDataSource(COleControl* pCtrl);
protected:
virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);
virtual BOOL OnRenderFileData(LPFORMATETC lpFormatEtc, CFile* pFile);
virtual BOOL OnRenderData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium);
virtual BOOL OnSetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
BOOL bRelease);
COleControl* m_pCtrl;
};
friend class CControlDataSource;
// IDataObject formats
CControlDataSource* GetDataSource();
virtual void SetInitialDataFormats();
BOOL GetPropsetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
REFCLSID fmtid);
BOOL SetPropsetData(LPFORMATETC lpFormatEtc, LPSTGMEDIUM lpStgMedium,
REFCLSID fmtid);
// Type library
BOOL GetDispatchIID(IID* pIID);
// Connection point container
virtual LPCONNECTIONPOINT GetConnectionHook(REFIID iid);
virtual BOOL GetExtraConnectionPoints(CPtrArray* pConnPoints);
// Events
static const AFX_DATA AFX_EVENTMAP_ENTRY _eventEntries[];
virtual const AFX_EVENTMAP* GetEventMap() const;
static const AFX_DATA AFX_EVENTMAP eventMap;
const AFX_EVENTMAP_ENTRY* GetEventMapEntry(LPCTSTR pszName,
DISPID* pDispid) const;
void FireEventV(DISPID dispid, BYTE* pbParams, va_list argList);
// Stock events
void KeyDown(USHORT* pnChar);
void KeyUp(USHORT* pnChar);
void ButtonDown(USHORT iButton, UINT nFlags, CPoint point);
void ButtonUp(USHORT iButton, UINT nFlags, CPoint point);
void ButtonDblClk(USHORT iButton, UINT nFlags, CPoint point);
// Masks to identify which stock events and properties are used
void InitStockEventMask();
void InitStockPropMask();
DWORD GetStockEventMask() const;
DWORD GetStockPropMask() const;
// Support for subclassing a Windows control
CWnd* GetOuterWindow() const; // m_pReflect if any, otherwise this
virtual void OnReflectorDestroyed();
// Aggregation of default handler
virtual BOOL OnCreateAggregates();
LPVOID QueryDefHandler(REFIID iid);
// State change notifications
void SendAdvise(UINT uCode);
// Non-in-place activation
virtual HRESULT OnOpen(BOOL bTryInPlace, LPMSG pMsg);
#ifdef _AFXDLL
void ResizeOpenControl(int cx, int cy);
virtual CControlFrameWnd* CreateFrameWindow();
virtual void ResizeFrameWindow(int cx, int cy);
virtual void OnFrameClose();
#endif
virtual HRESULT OnHide();
// In-place activation
virtual HRESULT OnActivateInPlace(BOOL bUIActivate, LPMSG pMsg);
void ForwardActivationMsg(LPMSG pMsg);
virtual void AddFrameLevelUI();
virtual void RemoveFrameLevelUI();
virtual BOOL BuildSharedMenu();
virtual void DestroySharedMenu();
// Property sheet
virtual LPCLSID GetPropPageIDs(ULONG& cPropPages);
// IOleObject implementation
void GetUserType(LPTSTR pszUserType);
virtual UINT GetUserTypeNameID() = 0;
virtual DWORD GetMiscStatus() = 0;
// Rectangle tracker
void CreateTracker(BOOL bHandles, BOOL bHatching);
void CreateTracker(BOOL bHandles, BOOL bHatching, LPCRECT prcClip);
void DestroyTracker();
// Automation
BOOL IsInvokeAllowed(DISPID dispid);
// Ambient property interface initialization
COleDispatchDriver* GetAmbientDispatchDriver();
// Data members
const IID* m_piidPrimary; // IID for control automation
const IID* m_piidEvents; // IID for control events
DWORD m_dwVersionLoaded; // Version number of loaded state
COleDispatchDriver m_ambientDispDriver; // Driver for ambient properties
ULONG m_cEventsFrozen; // Event freeze count (>0 means frozen)
union
{
#ifdef _AFXDLL
CControlFrameWnd* m_pWndOpenFrame; // Open frame window.
#endif
CControlRectTracker* m_pRectTracker; // Tracker for UI active control
};
CRect m_rcPos; // Control's position rectangle
CRect m_rcBounds; // Bounding rectangle for drawing
CPoint m_ptOffset; // Child window origin
long m_cxExtent; // Control's width in HIMETRIC units
long m_cyExtent; // Control's height in HIMETRIC units
class CReflectorWnd* m_pReflect; // Reflector window
UINT m_nIDTracking; // Tracking command ID or string IDS
UINT m_nIDLastMessage; // Last displayed message string IDS
unsigned m_bAutoMenuEnable : 1; // Disable menu items without handlers?
unsigned m_bFinalReleaseCalled : 1; // Are we handling the final Release?
unsigned m_bModified : 1; // "Dirty" bit.
unsigned m_bCountOnAmbients : 1; // Can we count on Ambients during load?
unsigned m_iButtonState : 3; // Which buttons are down?
unsigned m_iDblClkState : 3; // Which buttons involved in dbl click?
unsigned m_bInPlaceActive : 1; // Are we in-place active?
unsigned m_bUIActive : 1; // Are we UI active?
unsigned m_bPendingUIActivation : 1; // Are we about to become UI active?
#ifdef _AFXDLL
unsigned m_bOpen : 1; // Are we open (non-in-place)?
#endif
unsigned m_bChangingExtent : 1; // Extent is currently being changed
unsigned m_bConvertVBX : 1; // VBX conversion in progress
unsigned m_bSimpleFrame : 1; // Simple frame support
unsigned m_bUIDead : 1; // UIDead ambient property value
unsigned m_bInitialized : 1; // Was IPersist*::{InitNew,Load} called?
unsigned m_bAutoClip : 1; // Does container automatically clip?
unsigned m_bMsgReflect : 1; // Does container reflect messages?
unsigned m_bInPlaceSiteEx : 1; // Extended in-place site?
unsigned m_bInPlaceSiteWndless : 1; // Windowless in-place site?
unsigned m_bNoRedraw : 1; // Should we skip OnPaint this time?
unsigned m_bOptimizedDraw : 1; // Is optimized drawing possible?
// Stock properties
OLE_COLOR m_clrBackColor; // BackColor
OLE_COLOR m_clrForeColor; // ForeColor
CString m_strText; // Text/Caption
CFontHolder m_font; // Font
HFONT m_hFontPrev; // Previously selected font object
short m_sAppearance; // Appearance
short m_sBorderStyle; // BorderStyle
BOOL m_bEnabled; // Enabled
long m_lReadyState; // ReadyState
// UI Active info (shared OLE menu data)
_AFXCTL_UIACTIVE_INFO* m_pUIActiveInfo;
// Default Handler aggregation
LPUNKNOWN m_pDefIUnknown;
_AFXCTL_ADVISE_INFO* m_pAdviseInfo;
LPPERSISTSTORAGE m_pDefIPersistStorage;
LPVIEWOBJECT m_pDefIViewObject;
LPOLECACHE m_pDefIOleCache;
// OLE client site interfaces
LPOLECLIENTSITE m_pClientSite; // Client site
union
{
LPOLEINPLACESITE m_pInPlaceSite; // In-place site
LPOLEINPLACESITEEX m_pInPlaceSiteEx;
LPOLEINPLACESITEWINDOWLESS m_pInPlaceSiteWndless;
};
LPOLECONTROLSITE m_pControlSite; // Control site
LPOLEADVISEHOLDER m_pOleAdviseHolder; // Advise holder
LPDATAADVISEHOLDER m_pDataAdviseHolder; // Data advise holder
LPSIMPLEFRAMESITE m_pSimpleFrameSite; // Simple frame site
// OLE in-place activation info
LPOLEINPLACEFRAME m_pInPlaceFrame;
OLEINPLACEFRAMEINFO m_frameInfo;
LPOLEINPLACEUIWINDOW m_pInPlaceDoc;
// OLE data source
CControlDataSource* m_pDataSource;
// OLE data path load data
BOOL m_bDataPathPropertiesLoaded;
DWORD m_dwDataPathVersionToReport;
// Message Maps
protected:
//{{AFX_MSG(COleControl)
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
afx_msg void OnMButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point);
afx_msg void OnInitMenuPopup(CMenu*, UINT, BOOL);
afx_msg void OnMenuSelect(UINT nItemID, UINT nFlags, HMENU hSysMenu);
afx_msg LRESULT OnSetMessageString(WPARAM wParam, LPARAM lParam);
afx_msg void OnEnterIdle(UINT nWhy, CWnd* pWho);
afx_msg void OnCancelMode();
afx_msg void OnPaint(CDC* pDC);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSysKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnSysKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg int OnMouseActivate(CWnd *pDesktopWnd, UINT nHitTest, UINT message);
afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnKillFocus(CWnd* pNewWnd);
afx_msg void OnSetFocus(CWnd* pOldWnd);
afx_msg void OnNcPaint();
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
afx_msg UINT OnNcHitTest(CPoint point);
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
afx_msg UINT OnGetDlgCode();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnMove(int x, int y);
afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
//}}AFX_MSG
afx_msg LRESULT OnOcmCtlColorBtn(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorDlg(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorEdit(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorListBox(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorMsgBox(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorScrollBar(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnOcmCtlColorStatic(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
// button handler helpers
void OnButtonUp(USHORT nButton, UINT nFlags, CPoint point);
void OnButtonDown(USHORT nButton, UINT nFlags, CPoint point);
void OnButtonDblClk(USHORT nButton, UINT nFlags, CPoint point);
// Interface Maps
public:
// IPersistStorage
BEGIN_INTERFACE_PART(PersistStorage, IPersistStorage)
INIT_INTERFACE_PART(COleControl, PersistStorage)
STDMETHOD(GetClassID)(LPCLSID);
STDMETHOD(IsDirty)();
STDMETHOD(InitNew)(LPSTORAGE);
STDMETHOD(Load)(LPSTORAGE);
STDMETHOD(Save)(LPSTORAGE, BOOL);
STDMETHOD(SaveCompleted)(LPSTORAGE);
STDMETHOD(HandsOffStorage)();
END_INTERFACE_PART_STATIC(PersistStorage)
// IPersistStreamInit
BEGIN_INTERFACE_PART(PersistStreamInit, IPersistStreamInit)
INIT_INTERFACE_PART(COleControl, PersistStreamInit)
STDMETHOD(GetClassID)(LPCLSID);
STDMETHOD(IsDirty)();
STDMETHOD(Load)(LPSTREAM);
STDMETHOD(Save)(LPSTREAM, BOOL);
STDMETHOD(GetSizeMax)(ULARGE_INTEGER *);
STDMETHOD(InitNew)();
END_INTERFACE_PART_STATIC(PersistStreamInit)
// IPersistMemory
BEGIN_INTERFACE_PART(PersistMemory, IPersistMemory)
INIT_INTERFACE_PART(COleControl, PersistMemory)
STDMETHOD(GetClassID)(LPCLSID);
STDMETHOD(IsDirty)();
STDMETHOD(Load)(LPVOID, ULONG);
STDMETHOD(Save)(LPVOID, BOOL, ULONG);
STDMETHOD(GetSizeMax)(ULONG*);
STDMETHOD(InitNew)();
END_INTERFACE_PART_STATIC(PersistMemory)
// IPersistPropertyBag
BEGIN_INTERFACE_PART(PersistPropertyBag, IPersistPropertyBag)
INIT_INTERFACE_PART(COleControl, PersistPropertyBag)
STDMETHOD(GetClassID)(LPCLSID);
STDMETHOD(InitNew)();
STDMETHOD(Load)(LPPROPERTYBAG, LPERRORLOG);
STDMETHOD(Save)(LPPROPERTYBAG, BOOL, BOOL);
END_INTERFACE_PART_STATIC(PersistPropertyBag)
// IOleObject
BEGIN_INTERFACE_PART(OleObject, IOleObject)
INIT_INTERFACE_PART(COleControl, OleObject)
STDMETHOD(SetClientSite)(LPOLECLIENTSITE);
STDMETHOD(GetClientSite)(LPOLECLIENTSITE*);
STDMETHOD(SetHostNames)(LPCOLESTR, LPCOLESTR);
STDMETHOD(Close)(DWORD);
STDMETHOD(SetMoniker)(DWORD, LPMONIKER);
STDMETHOD(GetMoniker)(DWORD, DWORD, LPMONIKER*);
STDMETHOD(InitFromData)(LPDATAOBJECT, BOOL, DWORD);
STDMETHOD(GetClipboardData)(DWORD, LPDATAOBJECT*);
STDMETHOD(DoVerb)(LONG, LPMSG, LPOLECLIENTSITE, LONG, HWND, LPCRECT);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -