Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get version of rich edit library

ALL,

Is it possible to get the version of the RichEdit control the program uses?

| Version    | Class name    | Library      | Shipped with    | New features
|------------|---------------|--------------|-----------------|    
| 1.0        | "RICHEDIT"    | Riched32.dll | Windows 95      |
| 2.0        | "RichEdit20W" | Riched20.dll | Windows 98      | ITextDocument
| 3.0        | "RichEdit20W" | Riched20.dll | Windows 2000    | ITextDocument2
| 3.1        | "RichEdit20W" | Riched20.dll | Server 2003     |
| 4.1        | "RICHEDIT50"  | Msftedit.dll | Windows XP SP1  | tomApplyTmp
| 7.5        | "RICHEDIT50"  | Msftedit.dll | Windows 8       | ITextDocument2 (new), ITextDocument2Old, Spell checking, Ink support, Office Math
| 8.5        | "RICHEDIT50"  | Msftedit.dll | Windows 10      | LocaleName, more image formats

I know I can just have some variable and assign it appropriately if Msftedit.dll library is loaded or not. However if I do load RichEd20.dll, I can get either RichEdit 2 or RichEdit 3 implementation. And they are quite different. A lot of stuff were added in the latter.

If i did load Msftedit.dll, there are features that 7.5 that would not be available in earlier versions (e.g. automatic spell checking).

It's even possible that the same process can have all three DLLs loaded, and even using all three versions of RichEdit in the same process:

  • "RICHEDIT" → 1.0
  • "RichEdit20W" → 2.0, 3.0
  • "RICHEDIT50" → 4.1, 7.5, 8.5

Given a RichEdit control (e.g. WinForms RichTextBox, WPF RichTextBox, WinRT RichEditBox, VCL TRichEdit) is there a way to determine the version of a RichEdit control?

Or maybe I can somehow differentiate them by Windows version where it is available?

like image 520
Igor Avatar asked Nov 09 '22 05:11

Igor


1 Answers

If using c++ you may find the following snippet useful to read out the class name :

  TCHAR className[MAX_PATH];
  GetClassName(GetRichEditCtrl().GetSafeHwnd(), className, _countof(className));

GetRichEditCtrl() is function on another control, you may need to substitute with whatever gives you a hwnd to the control.

Another method is using a tool like spy++ to inspect the class name.

like image 88
darune Avatar answered Dec 05 '22 06:12

darune