richedit cricheditctrl richedit20a之间的关系。

本文详细解释了 RichEdit 控件的不同版本及其在 MFC 中的应用。涵盖了从基本的 RichEdit 到 RichEdit20A 的升级过程,并介绍了如何在程序中实现这些控件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

请问richedit cricheditctrl richedit20a之间的关系。

作者:crystal521

marginwidth="0" marginheight="0" src="请问richedit cricheditctrl richedit20a之间的关系。.files/468x60x2.htm" frameborder="0" width="468" scrolling="no" height="60">


1。cricheditctrl是对 richedit的封装。这句话对吗。  
lotus 2。 richedit20a在mfc中有没有提供响应的类。???  
 
 
---------------------------------------------------------------  
 
richedit是指   richedit  控件  
 
cricheditctrl是   richedit类  
 
richedit20a是 richedit的升级,因为老版本的 richedit  有种种bug,如  半个汉字之类的问题,微软已经在 richedit2.o中解决了问题.要在程序中使用 richedit2.0  ,可以按照一下步骤实施:  
 
1    对话框中放置一个custom  控件  更改类名属性(class)为 RichEdit20A,  
2    InitInstance中添加        LoadLibrary("riched20.dll");  
3    头文件中声明:  CRichEditCtrl  m_RichEd;  
4    InitDialog中:    m_RichEd.SubclassDlgItem(IDD_CUSTOM1,this);  
 
这样就可以用这个变量来控制2.0版的 richedit了  
 
动态创建也是可以的:  
::CreateWindowEx(WS_EX_CLIENTEDGE,_T(" RichEdit20A"),_T("动态创建"),WS_VISIBLE  ¦WS_CHILD,0,0,100,100,GetSafeHwnd(),0,0,0);  
现在已经有5。0版了  
 
来源: http://www.codeguru.com/cpp/controls/richedit/article.php/c2389/CRichEditCtrlEx--Replacing-RICHEDIT-control-with-RichEdit20A.htm While writing a dev notes Visual Studio plug in, I wanted the rich edit control in a dialog to understand URL's so developers could add links to sites and email addresses. After talking to "Long John", he led me to the easy way of doing it, and now I am posting the work for others. Basically this requires CRichEditCtrlEx to use the new rich edit DLL RICHED20.DLL. The first thing to do it change the window class name of the rich edit controls from "RICHEDIT" to "RichEdit20A" in the *.rc file. Next, we create a class derived from CRichEditCtrl called CRichEditCtrlEx and override the Create() method: class CRichEditCtrlEx : public CRichEditCtrl { public: CRichEditCtrlEx(); virtual ~CRichEditCtrlEx(); // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL( CRichEditCtrlEx ) public: virtual BOOL Create( DWORD in_dwStyle, const RECT& in_rcRect, CWnd* in_pParentWnd, UINT in_nID ); //}}AFX_VIRTUAL // Generated message map functions protected: //{{AFX_MSG( CRichEditCtrlEx ) //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Now implement the Create() method like this: Post a comment Email Article Print Article Share Articles Digg del.icio.us Newsvine Facebook Google LinkedIn MySpace Reddit Slashdot StumbleUpon Technorati Twitter Windows Live YahooBuzz FriendFeed BOOL CRichEditCtrlEx::Create(DWORD in_dwStyle, const RECT& in_rcRect, CWnd* in_pParentWnd, UINT in_nID) { if( ! ::AfxInitRichEditEx() ) { return FALSE ; } CWnd* l_pWnd = this ; return l_pWnd->Create( _T( "RichEdit20A" ), NULL, in_dwStyle, in_rcRect, in_pParentWnd, in_nID ); } This is almost exactly what is in CRichEditCtrl::Create(), except the different window class name, and the call to AfxInitRichEdit() has been changed to AfxInitRichEditEx() which first calls AfxInitRichEdit (we do not want to break the normal CRichEditCtrl). In the RichEditCtrlEx.h file, you need to add the DLL holder class and function prototype: class _AFX_RICHEDITEX_STATE { public: _AFX_RICHEDITEX_STATE(); virtual ~_AFX_RICHEDITEX_STATE(); HINSTANCE m_hInstRichEdit20 ; }; BOOL PASCAL AfxInitRichEditEx(); Now, in the source code, add the implementation: _AFX_RICHEDITEX_STATE::_AFX_RICHEDITEX_STATE() { m_hInstRichEdit20 = NULL ; } _AFX_RICHEDITEX_STATE::~_AFX_RICHEDITEX_STATE() { if( m_hInstRichEdit20 != NULL ) { ::FreeLibrary( m_hInstRichEdit20 ) ; } } _AFX_RICHEDITEX_STATE _afxRichEditStateEx ; BOOL PASCAL AfxInitRichEditEx() { if( ! ::AfxInitRichEdit() ) { return FALSE ; } _AFX_RICHEDITEX_STATE* l_pState = &_afxRichEditStateEx ; if( l_pState->m_hInstRichEdit20 == NULL ) { l_pState->m_hInstRichEdit20 = LoadLibraryA("RICHED20.DLL") ; } return l_pState->m_hInstRichEdit20 != NULL ; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值