YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   Home Products | Purchase Support | Downloads  
View in English
View in Japanese
View in
참고
View in Français
View in Italiano
View in 中文(繁體)
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
VX++ Cross-Platform C/C++
Overview
Download
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET

RichEdit Control in MFC CRichEditView and MSFTEDIT

Introduction

The last available version of Windows RichEdit control is 4.1. However, the MFC framework still uses older versions of this control. For example, MFC 6.0 uses RichEdit control 1, which is very obsolete and even newer MFC versions that shipped with Visual Studio 2005-2010 use RichEdit control 2 or 3.

How to Overcome This?

In order to use RichEdit control 4.1 in CRichEditView MFC class, and enjoy its new features, we can do the following steps:

Step 1

In the MFC application class (derived from CWinApp) load the MSFTEDIT.DLL library module, which contains RichEdit control 4.1.

  1. BOOL CRichEdit41App::InitInstance()
  2. {
  3. // Load RichEdit 4.1 library
  4. HMODULE hRE41Module = ::LoadLibrary(_T("MSFTEDIT.DLL"));
  5. if(NULL == hRE41Module)
  6. {
  7. AfxMessageBox(_T("RichEdit 4.1 library could not be loaded"));
  8. return FALSE;
  9. }
  10. // ...
  11. }

Step 2

In the MFC view class (derived from CRichEditView) constructor, set the window class name for RichEdit 4.1, which is "RICHEDIT50W".

  1. // Note: MSFTEDIT_CLASS is not defined in MFC6.0 and older
  2. #ifndef MSFTEDIT_CLASS
  3. #define MSFTEDIT_CLASS L"RICHEDIT50W";
  4. #endif
  5.  
  6. CRichEdit41View::CRichEdit41View()
  7. {
  8. m_strClass = MSFTEDIT_CLASS;
  9. }
 

Step 3

In the WM_DESTROY message handler, move below the base class method call.
Note: this step is necessary in MFC6.0 and older.

  1. void CRichEdit41View::OnDestroy()
  2. {
  3. // CRichEditView::OnDestroy(); // <-- move this line below
  4. COleClientItem* pActiveItem = GetDocument()->GetInPlaceActiveItem(this);
  5. if (pActiveItem != NULL && pActiveItem->GetActiveView() == this)
  6. {
  7. pActiveItem->Deactivate();
  8. ASSERT(GetDocument()->GetInPlaceActiveItem(this) == NULL);
  9. }
  10. CRichEditView::OnDestroy(); // <-- moved from above
  11. }

Download Demo

News:

1 UCanCode Advance E-XD++ CAD Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!

2 UCanCode Advance E-XD++ HMI & SCADA Source Code Solution for C/C++, .NET V2023 is released!

3 UCanCode Advance E-XD++ GIS SVG Drawing and Printing Solution Source Code Solution for C/C++, .NET V2023 is released!


Contact UCanCode Software

To buy the source code or learn more about with:

Ask any questions by MSN: ucancode@hotmail.com Yahoo: ucan_code@yahoo.com


 

Copyright ?1998-2023 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net