Richedit控件.docx_第1页
Richedit控件.docx_第2页
Richedit控件.docx_第3页
Richedit控件.docx_第4页
Richedit控件.docx_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

关于windowless的rich edit:1.看了一个介绍:个人猜测就是首先要写一个类,来实现ITextHost这个接口,同个这个类来把宿主窗口和无窗口的richedit联系起来。然后调用CreateTextServices,传入ITextHost指针,返回IUnknown指针。通过这个IUnown接口,可以查询到ITextServices和ITextDocument接口。最后通过这两个接口完成绝大多数功能。一般来说是无法直接通过调用接口的方式来获取无窗口RichEdit所处的HostWindow的,但是可以利用ITextHost的一些函数配合Win32API来得到HostWindow的窗口句柄比如:ITextHost *pHost;/此处可以通过ITextServices的QueryInterface得到ITextHost的指针然后调用pHost-TxSetCapture(TRUE)让窗口捕获鼠标,巧妙地地方就在这里,这时候你只要调用普通的Win32API:GetCapture()就可以得到HostWindow的窗口句柄了。注意获取完窗口句柄后要调用TxSetCapture(FALSE)释放鼠标。*#include textserv.h#define FValidCF(_pcf) (_pcf)-cbSize = sizeof(CHARFORMAT)#define FValidPF(_ppf) (_ppf)-cbSize = sizeof(PARAFORMAT)typedef void (* PNOTIFY_CALL)(int iNotify);#define HOST_BORDER 5#define LY_PER_INCH 1440EXTERN_C const IID IID_ITextEditControl;/* TXTEFFECT enumDefines different background styles control*/enum TXTEFFECT TXTEFFECT_NONE = 0,/ememno special backgoround effectTXTEFFECT_SUNKEN,/ememdraw a sunken 3-D look;interface ITextEditControl : public IUnknownvirtual LRESULTTxWindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) = 0;class MyTextHost :public ITextHostpublic:/ -/IUnknown interface/ -virtual HRESULT _stdcall QueryInterface(REFIID riid, void *ppvObject);virtual ULONG _stdcall AddRef(void);virtual ULONG _stdcall Release(void);/ -MyTextHost();MyTextHost();BOOL Init(HWND h_wnd, const CREATESTRUCT *pcs, PNOTIFY_CALL p_nc);/cmember Get the DC for the host HDC TxGetDC();/cmember Release the DC gotten from the host INTTxReleaseDC(HDC hdc);/cmember Show the scroll bar BOOL TxShowScrollBar(INT fnBar, BOOL fShow);/cmember Enable the scroll bar BOOL TxEnableScrollBar (INT fuSBFlags, INT fuArrowflags);/cmember Set the scroll range BOOL TxSetScrollRange(INT fnBar,LONG nMinPos,INT nMaxPos,BOOL fRedraw);/cmember Set the scroll position BOOL TxSetScrollPos (INT fnBar, INT nPos, BOOL fRedraw);/cmember InvalidateRect voidTxInvalidateRect(LPCRECT prc, BOOL fMode);/cmember Send a WM_PAINT to the window void TxViewChange(BOOL fUpdate);/cmember Create the caret BOOLTxCreateCaret(HBITMAP hbmp, INT xWidth, INT yHeight);/cmember Show the caret BOOLTxShowCaret(BOOL fShow);/cmember Set the caret position BOOLTxSetCaretPos(INT x, INT y);/cmember Create a timer with the specified timeout BOOL TxSetTimer(UINT idTimer, UINT uTimeout);/cmember Destroy a timer void TxKillTimer(UINT idTimer);/cmember Scroll the content of the specified windows client area voidTxScrollWindowEx (INT dx,INT dy,LPCRECT lprcScroll,LPCRECT lprcClip,HRGN hrgnUpdate,LPRECT lprcUpdate,UINT fuScroll);/cmember Get mouse capture voidTxSetCapture(BOOL fCapture);/cmember Set the focus to the text window voidTxSetFocus();/cmember Establish a new cursor shape void TxSetCursor(HCURSOR hcur, BOOL fText);/cmember Converts screen coordinates of a specified point to the client coordinates BOOL TxScreenToClient (LPPOINT lppt);/cmember Converts the client coordinates of a specified point to screen coordinates BOOLTxClientToScreen (LPPOINT lppt);/cmember Request host to activate text services HRESULTTxActivate( LONG * plOldState );/cmember Request host to deactivate text services HRESULTTxDeactivate( LONG lNewState );/cmember Retrieves the coordinates of a windows client area HRESULTTxGetClientRect(LPRECT prc);/cmember Get the view rectangle relative to the inset HRESULTTxGetViewInset(LPRECT prc);/cmember Get the default character format for the text HRESULT TxGetCharFormat(const CHARFORMATW *ppCF );/cmember Get the default paragraph format for the text HRESULTTxGetParaFormat(const PARAFORMAT *ppPF);/cmember Get the background color for the window COLORREFTxGetSysColor(int nIndex);/cmember Get the background (either opaque or transparent) HRESULTTxGetBackStyle(TXTBACKSTYLE *pstyle);/cmember Get the maximum length for the text HRESULTTxGetMaxLength(DWORD *plength);/cmember Get the bits representing requested scroll bars for the window HRESULTTxGetScrollBars(DWORD *pdwScrollBar);/cmember Get the character to display for password input HRESULTTxGetPasswordChar(TCHAR *pch);/cmember Get the accelerator character HRESULTTxGetAcceleratorPos(LONG *pcp);/cmember Get the native size HRESULTTxGetExtent(LPSIZEL lpExtent);/cmember Notify host that default character format has changed HRESULT OnTxCharFormatChange (const CHARFORMATW * pcf);/cmember Notify host that default paragraph format has changed HRESULTOnTxParaFormatChange (const PARAFORMAT * ppf);/cmember Bulk access to bit properties HRESULTTxGetPropertyBits(DWORD dwMask, DWORD *pdwBits);/cmember Notify host of events HRESULTTxNotify(DWORD iNotify, void *pv);/ Far East Methods for getting the Input Context/#ifdef WIN95_IME HIMCTxImmGetContext(); vo

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论