文件名称:
Replacing "RICHEDIT" control with "RichEdit20A"
开发工具:
文件大小: 15kb
下载次数: 0
上传时间: 2010-07-25
详细说明: 来源: 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 d o 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 ; } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.