Get version of rich edit library

橙三吉。 提交于 2020-12-31 04:40:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/32397734/get-version-of-rich-edit-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!