The MASM Forum

General => The Campus => Topic started by: Mikl__ on May 29, 2019, 09:17:30 PM

Title: Msftedit.dll
Post by: Mikl__ on May 29, 2019, 09:17:30 PM
The original specification for rich edit controls is Microsoft Rich Edit 1.0; the current specification is Microsoft Rich Edit 4.1. Each version of rich edit is a superset of the preceding one, except that only Asian builds of Microsoft Rich Edit 1.0 have a vertical text option. Before creating a rich edit control, you should call the LoadLibrary function to verify which version of Microsoft Rich Edit is installed.

The following table shows which DLL corresponds with which version of Rich Edit. Note that the name of the file did not change from version 2.0 to version 3.0. This allows version 2.0 to be upgraded to version 3.0 without breaking existing code.

Rich Edit version
DLL
Window Class
1.0
|Riched32.dll|
RICHEDIT
2.0
|Riched20.dll|
RICHEDIT20A
3.0
|Riched20.dll|
RICHEDIT20A
4.1
Msftedit.dll
RichEdit50W
Does anyone have any examples on how to use Msftedit.dll? Thank you.
Title: Re: Msftedit.dll
Post by: LiaoMi on May 29, 2019, 09:57:58 PM
Quote from: Mikl__ on May 29, 2019, 09:17:30 PM
The original specification for rich edit controls is Microsoft Rich Edit 1.0; the current specification is Microsoft Rich Edit 4.1. Each version of rich edit is a superset of the preceding one, except that only Asian builds of Microsoft Rich Edit 1.0 have a vertical text option. Before creating a rich edit control, you should call the LoadLibrary function to verify which version of Microsoft Rich Edit is installed.

The following table shows which DLL corresponds with which version of Rich Edit. Note that the name of the file did not change from version 2.0 to version 3.0. This allows version 2.0 to be upgraded to version 3.0 without breaking existing code.

Rich Edit version
DLL
Window Class
1.0
   Riched32.dll
RICHEDIT
2.0
   Riched20.dll
RICHEDIT20A
3.0
   Riched20.dll
RICHEDIT20A
4.1
   Msftedit.dllMSFTEDIT_CLASS
Does anyone have any examples on how to use Msftedit.dll? Thank you.

Hi Mikl,

http://masm32.com/board/index.php?topic=5383.0 (http://masm32.com/board/index.php?topic=5383.0)
Title: Re: Msftedit.dll
Post by: jj2007 on May 29, 2019, 10:10:39 PM
For your WM_CREATE handler:
invoke LoadLibrary, chr$("msftedit")
invoke CreateWindowEx, WS_EX_CLIENTEDGE, chr$("RichEdit50W"), NULL,
  WS_CHILD or WS_VISIBLE or WS_BORDER or WS_VSCROLL or ES_MULTILINE,
  9, 9, 500, 200, hWnd, 103, wcx.hInstance, NULL ; we have added an edit control
mov hEdit, eax


Quote from: LiaoMi on May 29, 2019, 09:57:58 PMhttp://masm32.com/board/index.php?topic=5383.0 (http://masm32.com/board/index.php?topic=5383.0)

M$ discontinued the Word viewer: We're sorry, this download is no longer available

In case you want to use a more advanced version of RichEdit: https://filehippo.com/download_word_viewer/ still has it.
Title: Re: Msftedit.dll
Post by: Mikl__ on May 29, 2019, 10:34:36 PM
Hi, LiaoMi and jj2007!
I took the 33-th lesson of Iczelion, replaced "Riched20.dll" to "msftedit.dll" and "RichEdit20A" to "RichEdit50W" and it all worked! Thank you very much! (https://wasm.in/styles/smiles_s/good3.gif)
Title: Re: Msftedit.dll
Post by: Vortex on May 30, 2019, 03:52:55 AM
Another source :

https://www.filehorse.com/download-word-viewer/
Title: Re: Msftedit.dll
Post by: jj2007 on May 30, 2019, 06:04:18 AM
Quote from: Vortex on May 30, 2019, 03:52:55 AM
Another source :

https://www.filehorse.com/download-word-viewer/

Interesting, Erol. To the left, the filehorse version, to the right the one that I have been using until now. After installing the WordViewer, they are in C:\Program Files (x86)\Common Files\microsoft shared\OFFICE11\RICHED20.DLL
Title: Re: Msftedit.dll
Post by: minor28 on May 30, 2019, 04:34:45 PM
Another example

https://www.codeproject.com/Articles/1030858/An-Idea-How-to-Use-RichEdit-W-for-Syntax-Highlight
Title: Re: Msftedit.dll
Post by: Mikl__ on May 30, 2019, 05:38:11 PM
Hi, Vortex and minor28!
Thank you very much! (https://wasm.in/styles/smiles_s/good3.gif)
Title: Re: Msftedit.dll
Post by: LiaoMi on May 30, 2019, 09:32:47 PM
Quote from: jj2007 on May 30, 2019, 06:04:18 AM
Quote from: Vortex on May 30, 2019, 03:52:55 AM
Another source :

https://www.filehorse.com/download-word-viewer/

Interesting, Erol. To the left, the filehorse version, to the right the one that I have been using until now. After installing the WordViewer, they are in C:\Program Files (x86)\Common Files\microsoft shared\OFFICE11\RICHED20.DLL

Hi jj2007,

your dll has another source  :azn:, since version 5.50.99.2010 is packaged in the installer. To check this, the installer can be opened using 7zip. The version on the left is the version I have on the system, as you can see, this is the 6th version.   

(https://i.imgur.com/5WEOYV5.png)
Title: Re: Msftedit.dll
Post by: aw27 on May 30, 2019, 09:58:23 PM
The full list of rich edit controls is here:
http://masm32.com/board/index.php?topic=7780.msg85317#msg85317

I have done a considerable investigation work on these creepy and cumbersome RichEdit controls and can only congratulate Mr. Murray Sargent and his team for making a living of more than 20 years through obscurity around the RichEdit.
Just for comparison purposes, TRichView is developed by a single person, is 10 times more advanced and is distributed with full source code when purchased, which is not a real fortune.
Title: Re: Msftedit.dll
Post by: LiaoMi on May 30, 2019, 10:04:07 PM
 :biggrin: with version 6 everything is fine, there is also a surprise version 8  :joking:
RichEdit 8.0 Preview https://blogs.msdn.microsoft.com/murrays/2012/03/03/richedit-8-0-preview/ (https://blogs.msdn.microsoft.com/murrays/2012/03/03/richedit-8-0-preview/)
RichEdit 9 Additions https://blogs.msdn.microsoft.com/murrays/2019/01/18/richedit-9-additions/ (https://blogs.msdn.microsoft.com/murrays/2019/01/18/richedit-9-additions/) I don't know where to download the 9th version ...

(https://i.imgur.com/wmipMyB.png)

0032 0016BE50 0025C6C9 ConvertEquationFromOleStream
0033 0016C2F0 0025C6E6 ConvertEquationFromStdVector
0031 0016C380 0025C703 ConvertEquationFromStorage
0034 0016C3A0 0025C71E ConvertEquationFromStorageEx
0029 0023B0E0 0025C73B CreateFormattedTextRichEdit
001A 00211170 0025C757 CreateMathXmlHandler
0017 000A1450 0025C76C CreateTextBoxLayout
0004 0000A2C0 0025C780 CreateTextServices
0014 00072E70 0025C793 DisableOleinitCheck
0022 0022D4D0 0025C7A7 DllCanUnloadNow
000C 000B3540 0025C7B7 DllGetVersion
0027 001808D0 0025C7C5 GetLanguageTag
0028 001808F0 0025C7D4 GetLcidFromLang
0016 001F87B0 0025C7E4 GetMathAlphanumeric
0015 001F8B70 0025C7F8 GetMathAlphanumericCode
0035 00207E50 0025C810 GetMathAutoComplete
001B 00208C80 0025C824 GetMathContextMenu
001D 002094E0 0025C837 GetMathContextMenuItems
002F 0020DDD0 0025C84F GetMathSpeechText
0038 000BE460 0025C861 GetOleMathSpeechText
0002 0025CB10 0025C876 IID_IRichEditOle
0003 0025C370 0025C887 IID_IRichEditOleCallback
0025 0025C380 0025C8A0 IID_IRicheditUiaNotificationOverrides
0021 0025C3A0 0025C8C6 IID_IRicheditUiaOverrides
0020 0025C390 0025C8E0 IID_IRicheditWindowlessAccessibility
0018 0025C360 0025C905 IID_ITextDocument2
0006 0025C320 0025C918 IID_ITextHost
0007 0025C310 0025C926 IID_ITextHost2
0010 0025C350 0025C935 IID_ITextHostEx
0005 0025C330 0025C945 IID_ITextServices
0019 0025C340 0025C957 IID_ITextServices2
0030 00171A50 0025C96A IsFontTemporary
0012 002026B0 0025C97A MathBuildDown
0011 00202740 0025C988 MathBuildUp
0013 00202A30 0025C994 MathTranslate
001C 00209AE0 0025C9A2 ProcessMathMenuID
0008 0007A8D0 0025C9B4 REExtendedRegisterClass
001F 0007A8C0 0025C9CC REMSOHInst
0026 00180940 0025C9D7 RegisterLanguageTag
002C 00171B20 0025C9EB RemoveFontFromCache
000F 0006E780 0025C9FF RichComboBoxWndProc
000A 00227830 0025CA13 RichEdit10ANSIWndProc
0009 002278D0 0025CA29 RichEditANSIWndProc
000D 00078620 0025CA3D RichEditWndProc
000E 0006F4F0 0025CA4D RichListBoxWndProc
000B 001E5F60 0025CA60 SetCustomTextOutHandlerEx
002D 001E5570 0025CA7A SetEdpPermissionMode
0024 000BAA40 0025CA8F SetTextServicesDpiCalculationOverride
0023 00071D00 0025CAB5 ShutdownTextServices
0037 00036C00 0025CACA TurnOffMathAutoCompleteList
0036 002082B0 0025CAE6 TurnOnMathAutoCompleteList
001E 0017A900 0025CB01 WriteMathPrSax


Quote from: AW on May 30, 2019, 09:58:23 PM
The full list of rich edit controls is here:
http://masm32.com/board/index.php?topic=7780.msg85317#msg85317

I have done a considerable investigation work on these creepy and cumbersome RichEdit controls and can only congratulate Mr. Murray Sargent and his team for making a living of more than 20 years through obscurity around the RichEdit.
Just for comparison purposes, TRichView is developed by a single person, is 10 times more advanced and is distributed with full source code when purchased, which is not a real fortune.

Hi AW,

thanks for the tip, I did not notice this description  :thumbsup:
Title: Re: Msftedit.dll
Post by: jj2007 on May 30, 2019, 10:50:51 PM
Version 8.0 ships with Office 2013 and works fine with RichMasm; version number is 15.0.4420.1017

There is a second 8.0 version that comes with Office 2016, 16.0.4327.1000 that is OK for small controls but crashes violently when used with RichMasm. I don't have the matching msptls.dll, though, although I doubt that is the reason for the crash.

RichMasm users can test the DLL by copying their version of RichEd20.dll into \Masm32\MasmBasic, together with the \Masm32\MasmBasic\MSPTLS.DLL. Launch RichMasm and press F9 to see the version info at the bottom.

See also Making RichEdit work properly on Windows 10 (http://masm32.com/board/index.php?topic=5383.msg57704#msg57704) and the answer by Hans Passant (https://stackoverflow.com/questions/29473940/using-newer-richedit-versions), plus Murray Sargent: RichEdit 9 Additions (https://blogs.msdn.microsoft.com/murrays/2019/01/18/richedit-9-additions/)
Title: Re: Msftedit.dll
Post by: hutch-- on May 31, 2019, 12:08:23 AM
 :biggrin:

I enjoy being a barbarian who still uses riched 3.0 as it has characteristics I like and its been around for years. I not only use it for my plain text editors but for the RTF help files I now do with it.

Testing a few new smilies.  :skrewy: :hmmm: :joking: :rofl: :toothy: :azn:
Title: Re: Msftedit.dll
Post by: aw27 on May 31, 2019, 01:09:00 AM
There is really not a significant difference from 3.0 to the latest and greatest.
Color emoticons still don't work, even with DirectWrite and Direct2D in the windowless version (despite apparent claims that it does). Inserting pictures is difficult as we know. Animated gifs, can't be done despite claims, unless we use a timer to display the image frames. Tables are a mess to work with. Math symbols don't work, despite claims. No samples whatsoever, showing how to use anything (other than the basic). A complete Nigerian scam.

:skrewy:  :skrewy: :skrewy: :skrewy:
Title: Re: Msftedit.dll
Post by: felipe on May 31, 2019, 02:42:56 AM
 :icon_arrow:
Quote from: AW on May 31, 2019, 01:09:00 AMA complete Nigerian scam.

that's funny
:cheezy:
Title: Re: Msftedit.dll
Post by: jj2007 on May 31, 2019, 05:30:58 AM
Quote from: AW on May 31, 2019, 01:09:00 AMTables are a mess to work with.

I have no urgent need for tables, but they do work in the Office11 and Office12 controls.

QuoteMath symbols don't work, despite claims.

There are certainly some big problems with math symbols, see the red text.

(http://www.jj2007.eu/images/Math.png)
Title: Re: Msftedit.dll
Post by: aw27 on May 31, 2019, 07:08:32 AM
Quote
There are certainly some big problems with math symbols, see the red text.

sic from Murray " the Microsoft Equation Editor 3.0 (MEE) was removed from Office installations because it has security problems and no maintenance. " . And there is the buggy latex way. And there is something new in RichEdit 9, but it sounds like nobody has ever seen it. I have Office 2019. Is it from Office 365?

Nope, Murray says: " we might as well call the current one RichEdit 9, This covers RichEdit up through Office 2019 and includes some features of more recent Office 365 versions."
But Office 2019 has RichEdit version 8, not 9.  :joking: :joking: :joking:
Is Murray, well of his mind?

Title: Re: Msftedit.dll
Post by: TimoVJL on June 01, 2019, 12:07:24 AM
One riched20.dll (16.0.4639) even try to show picture :thumbsup:
Almost there :biggrin: , but it didn't show file content  :sad:

What kind of programmers are in richedit team :undecided:
Different results between versions, crashing, ...
Not so professional way for programming. Have they heard about SEH, how to use it :undecided:
Murray can have some problems with that team.
Title: Re: Msftedit.dll
Post by: aw27 on June 01, 2019, 12:59:48 AM
To the left from Office 2016 to the right from Office 2019. (both updated today).

(https://www.dropbox.com/s/okde2u90nk7m7wo/riched20162019.jjpg.jpg?dl=1)

The one from Office 2019 is 550KB smaller.   :rofl: :rofl: :rofl:

Later: I forgot that the one on the left is 64-bit, the one on the right is 32-bit. So the difference in size is explained. Very likely, they have the exact same features.
Title: Re: Msftedit.dll
Post by: TimoVJL on June 01, 2019, 01:24:09 AM
So now we know some details of version 8, it have a some native support for pictures :thumbsup:
For example version 16.0.8907

Title: Re: Msftedit.dll
Post by: jj2007 on June 01, 2019, 01:53:57 AM
Hi Timo, have you seen the RtfSpecs (http://www.jj2007.eu/images/RtfSpecs.zip)?
Title: Re: Msftedit.dll
Post by: TimoVJL on June 01, 2019, 02:17:05 AM
Thanks :biggrin:
Nice :thumbsup:
Now we can test how riched20.dll works with it depending versions.
Also those speed test are now possible with common material.
Title: Re: Msftedit.dll
Post by: aw27 on June 01, 2019, 02:26:00 AM
I attach a fairly comprehensive RTF file. It is correctly displayed in Word and with a demo built with the TRichView component, I have mentioned earlier, like this:

(https://www.dropbox.com/s/to6c3ycbqndk7go/rtfDemo.jpg?dl=1)

Can anyone do the same with the RichEdit control in less than one week? Just a challenge...
Title: Re: Msftedit.dll
Post by: jj2007 on June 01, 2019, 02:50:49 AM
Quote from: AW on June 01, 2019, 02:26:00 AMCan anyone do the same with the RichEdit control in less than one week? Just a challenge...

Difficult  :biggrin:

Much of this stuff works fine in RichMasm (http://masm32.com/board/index.php?topic=5314.0), but OLE is not implemented, i.e. no embedded images, and hyperlinks work fine but they use the bb code syntax, i.e. url= ... text /url etc.

Tables work fine, math symbols work (http://masm32.com/board/index.php?topic=7885.msg86465#msg86465) with at least the Office14 version - and you must be very, very careful, the control is buggy, and several math symbols cause bad crashes. RM has two recover mechanisms, but still, I wouldn't recommend the math stuff.
Title: Re: Msftedit.dll
Post by: TimoVJL on June 02, 2019, 06:54:07 AM
riched20.dll 16.0.8907.1000 was able to read Word2007RTFSpec_1.9.rtf and show pictures without additional OLE code  :eusa_clap:
And that x64 version don't even need msptls.dll, it only mess things. So versions don't even behave similar way, what a mess.

But it don't handle Jose's rtftest.rtf

So riched20 from version 8 starts finally doing those things, but it took quite a long time by those "professional" MS programmers :skrewy:

Those who have those newer versions could test reading that Word2007RTFSpec_1.9.rtf and read what abandoned specs says.

A sad story :undecided:
Title: Re: Msftedit.dll
Post by: aw27 on June 03, 2019, 02:26:31 AM
I think you will need to implement the IRichEditOleCallback interface, but I never tried.  :sad:
Title: Re: Msftedit.dll
Post by: TimoVJL on June 03, 2019, 03:09:58 AM
Basic IRichEditOleCallback works only with OS riched20.dll and mstfedit.dll, but with not those Office riched20.dll versions  :sad:

EDIT: ITextDocument2  was a problem for opening a file.
Minimal code example in ASM
.model flat,stdcall
includelib "ole32.lib"

CoMethod1Proto typedef proto :DWORD
CoMethod2Proto typedef proto :DWORD, :DWORD
CoMethod3Proto typedef proto :DWORD, :DWORD, :DWORD
CoMethod4Proto typedef proto :DWORD, :DWORD, :DWORD, :DWORD
CoMethod5Proto typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD
CoMethod6Proto typedef proto :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD

CoMethod1 typedef ptr CoMethod1Proto
CoMethod2 typedef ptr CoMethod2Proto
CoMethod3 typedef ptr CoMethod3Proto
CoMethod4 typedef ptr CoMethod4Proto
CoMethod5 typedef ptr CoMethod5Proto
CoMethod6 typedef ptr CoMethod6Proto

IRichEditOleCallback STRUCT
QueryInterface CoMethod3 ?
AddRef CoMethod1 ?
Release CoMethod1 ?
GetNewStorage CoMethod2 ?
GetInPlaceContext CoMethod4 ?
ShowContainerUI CoMethod2 ?
QueryInsertObject CoMethod4 ?
DeleteObject CoMethod2 ?
QueryAcceptData CoMethod6 ?
ContextSensitiveHelp CoMethod3 ?
GetClipboardData CoMethod4 ?
GetDragDropEffect CoMethod4 ?
GetContextMenu CoMethod5 ?
IRichEditOleCallback ENDS

SendMessageA PROTO :DWORD,:DWORD,:DWORD,:DWORD
SendMessage EQU SendMessageA

CreateILockBytesOnHGlobal PROTO :DWORD,:DWORD,:PTR
StgCreateDocfileOnILockBytes PROTO :PTR,:DWORD,:DWORD,:PTR PTR

OutputDebugStringW PROTO :DWORD
OutputDebugString EQU OutputDebugStringW

public STDCALL REOCB_SetComInterface

.code
REOCB_QueryInterface PROC _This:PTR,riid:PTR,ppvObj:PTR
mov eax, 80004002h ; E_NOINTERFACE
ret
REOCB_QueryInterface ENDP

REOCB_AddRef PROC _This:PTR
mov eax, 1h
ret
REOCB_AddRef ENDP

REOCB_Release PROC _This:PTR
mov eax, 1h
ret
REOCB_Release ENDP

REOCB_GetNewStorage PROC _This:PTR,lplpstg:PTR PTR
LOCAL lpLockBytes:PTR
invoke CreateILockBytesOnHGlobal,0,1,ADDR lpLockBytes
.if eax
xor eax, eax
jmp @F
.endif
invoke StgCreateDocfileOnILockBytes,lpLockBytes,1012h,0,lplpstg
@@:
ret
REOCB_GetNewStorage ENDP

REOCB_GetInPlaceContext PROC _This:PTR,lplpFrame:PTR,lplpDoc:PTR,lpFrameInfo:PTR
mov eax, 80004002h
ret
REOCB_GetInPlaceContext ENDP

REOCB_ShowContainerUI PROC _This:PTR,fShow:DWORD
mov eax, 80004002h
ret
REOCB_ShowContainerUI ENDP

REOCB_QueryInsertObject PROC _This:PTR,lpclsid:PTR,lpstg:PTR,cp:DWORD
xor eax, eax ; S_OK
ret
REOCB_QueryInsertObject ENDP

REOCB_DeleteObject PROC _This:PTR,lpoleobj:PTR
mov eax, 80004002h
ret
REOCB_DeleteObject ENDP

REOCB_QueryAcceptData PROC _This:PTR,lpdataobj:PTR,lpcfFormat:PTR,reco:DWORD,fReally:DWORD,hMetaPict:PTR
mov eax, 80004002h
ret
REOCB_QueryAcceptData ENDP

REOCB_ContextSensitiveHelp PROC _This:PTR,fEnterMode:DWORD
mov eax, 80004002h
ret
REOCB_ContextSensitiveHelp ENDP

REOCB_GetClipboardData PROC _This:PTR,lpchrg:PTR,reco:DWORD,lplpdataobj:PTR
mov eax, 80004002h
ret
REOCB_GetClipboardData ENDP

REOCB_GetDragDropEffect PROC _This:PTR,fDrag:DWORD,frfKeyState:DWORD,pwEffect:DWORD PTR
mov eax, 80004002h
ret
REOCB_GetDragDropEffect ENDP

REOCB_GetContextMenu PROC _This:PTR,seltype:WORD,lpoleobj:PTR,lpchrg:PTR,lphmenu:PTR
mov eax, 80004002h
ret
REOCB_GetContextMenu ENDP

.data
IRichEditOleCallbackVtbl IRichEditOleCallback {REOCB_QueryInterface,REOCB_AddRef,REOCB_Release,
REOCB_GetNewStorage,REOCB_GetInPlaceContext,REOCB_ShowContainerUI,
REOCB_QueryInsertObject,REOCB_DeleteObject,REOCB_QueryAcceptData,REOCB_ContextSensitiveHelp,
REOCB_GetClipboardData,REOCB_GetDragDropEffect,REOCB_GetContextMenu}
ReOleCb DWORD OFFSET IRichEditOleCallbackVtbl

.code
REOCB_SetComInterface PROC hWnd:PTR,hEdit:PTR,pReOleCb:PTR
invoke SendMessage,hEdit,446h,0,ADDR ReOleCb
ret
REOCB_SetComInterface ENDP
END

Minimal code example in C
// ReOleCb.c for PellesC
#define WIN32_LEAN_AND_MEAN
#define WIN32_DEFAULT_LIBS
#include <windows.h>
#include <oleidl.h>
#include <richedit.h>
#include <richole.h>

#pragma intrinsic(memcpy)
//const CLSID IID_IUnknown = {0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};
//const CLSID IID_IRichEditOleCallback = {0x00020D03,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46};

int REFIID2String(REFIID riid, TCHAR *szREFIID)
{
return wsprintf(szREFIID,
TEXT("riid = {0x%08X,0x%04X,0x%04X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X,0x%02X};"),
riid->Data1, riid->Data2, riid->Data3,
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);
}

STDMETHODIMP ReOleCb_QueryInterface(IRichEditOleCallback *this, REFIID riid, LPVOID *ppvObj)
{
TCHAR szTmp[100];
REFIID2String(riid, szTmp);
OutputDebugString(szTmp);

*ppvObj = NULL;
OutputDebugString(TEXT("QueryInterface"));
return E_NOINTERFACE;
}

STDMETHODIMP_(ULONG) ReOleCb_AddRef(IRichEditOleCallback *this)
{
OutputDebugString(TEXT("AddRef"));
return 1;
}

STDMETHODIMP_(ULONG) ReOleCb_Release(IRichEditOleCallback *this)
{
OutputDebugString(TEXT("Release"));
return 1;
}

STDMETHODIMP ReOleCb_GetNewStorage(IRichEditOleCallback *this, LPSTORAGE* lplpstg)
{
OutputDebugString(TEXT("GetNewStorage"));
SCODE sc;
LPLOCKBYTES lpLockBytes = NULL;

sc = CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes);
if (sc != S_OK)
return 0;
sc = StgCreateDocfileOnILockBytes(lpLockBytes,
STGM_SHARE_EXCLUSIVE|STGM_CREATE|STGM_READWRITE, 0, lplpstg);
if (sc != S_OK) lpLockBytes->lpVtbl->Release(lpLockBytes);
return sc;
}

STDMETHODIMP ReOleCb_GetInPlaceContext(IRichEditOleCallback *this, LPOLEINPLACEFRAME *lplpFrame,
LPOLEINPLACEUIWINDOW *lplpDoc, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
OutputDebugString(TEXT("GetInPlaceContext"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_ShowContainerUI(IRichEditOleCallback *this, BOOL fShow)
{
OutputDebugString(TEXT("ShowContainerUI"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_QueryInsertObject(IRichEditOleCallback *this, LPCLSID lpclsid,
LPSTORAGE lpstg, LONG cp)
{
OutputDebugString(TEXT("QueryInsertObject"));
return S_OK;
}

STDMETHODIMP ReOleCb_DeleteObject(IRichEditOleCallback *this, LPOLEOBJECT lpoöeobj)
{
OutputDebugString(TEXT("DeleteObject"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_QueryAcceptData(IRichEditOleCallback *this, LPDATAOBJECT lpdataobj,
CLIPFORMAT *lpcfFormat, DWORD reco, BOOL fReally, HGLOBAL hMetaPict)
{
OutputDebugString(TEXT("QueryAcceptData"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_ContextSensitiveHelp(IRichEditOleCallback *this, BOOL fEnterMode)
{
OutputDebugString(TEXT("ContextSensitiveHelp"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_GetClipboardData(IRichEditOleCallback *this,
CHARRANGE *lpchrg, DWORD reco, LPDATAOBJECT *lplpdataobj)
{
OutputDebugString(TEXT("GetClipboardData"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_GetDragDropEffect(IRichEditOleCallback *this,
BOOL fDrag, DWORD frfKeyState, PDWORD pwEffect)
{
OutputDebugString(TEXT("GetDragDropEffect"));
return E_NOTIMPL;
}

STDMETHODIMP ReOleCb_GetContextMenu(IRichEditOleCallback *this,
WORD seltype, LPOLEOBJECT lpoleobj, CHARRANGE *lpchrg , HMENU *lphmenu)
{
OutputDebugString(TEXT("GetContextMenu"));
return E_NOTIMPL;
}

IRichEditOleCallbackVtbl ReOleVtbl = {
ReOleCb_QueryInterface,
ReOleCb_AddRef,
ReOleCb_Release,
ReOleCb_GetNewStorage,
ReOleCb_GetInPlaceContext,
ReOleCb_ShowContainerUI,
ReOleCb_QueryInsertObject,
ReOleCb_DeleteObject,
ReOleCb_QueryAcceptData,
ReOleCb_ContextSensitiveHelp,
ReOleCb_GetClipboardData,
ReOleCb_GetDragDropEffect,
ReOleCb_GetContextMenu,
};

IRichEditOleCallback ReOle = {&ReOleVtbl};

DWORD RichEditOleCallback_SetComInterface(HWND hWnd, HWND hEdit, IRichEditOleCallback** pReOleCb)
{
return SendMessage(hEdit, EM_SETOLECALLBACK, 0, (LPARAM)&ReOle);
}
Title: Re: Msftedit.dll
Post by: aw27 on June 03, 2019, 07:40:08 PM
The guy seems very happy with the solution.

https://social.msdn.microsoft.com/Forums/en-US/41e834bb-b797-4c9c-9886-df79ed7e050b/how-do-i-load-an-rtf-file-containing-image-into-rich-edit-control?forum=vcgeneral
Title: Re: Msftedit.dll
Post by: aw27 on June 04, 2019, 07:49:03 PM
The solution from the link above works, except for icons (I can't figure out what is missing). It works also with riched20.dll from Office 2016 x64-bits.

(https://www.dropbox.com/s/s7grbek5er40kpw/loadrtf.jpg?dl=1)

However, the Office 2016 has problems loading some documents like the RTF specification. It interrupts the loading near the beginning.
So. there is a reason for Microsoft hiding it 7 subfolders deep (even worse for Office 2019, nearly impossible to find where its riched20.dll is).
The bottom line is: Don't use the MS Office riched20.dll until Mr. Murray starts documenting things properly instead of producing useless marketing blogs.
Title: Re: Msftedit.dll
Post by: jj2007 on June 04, 2019, 08:41:42 PM
Quote from: AW on June 04, 2019, 07:49:03 PMDon't use the MS Office riched20.dll until Mr. Murray starts documenting things properly instead of producing useless marketing blogs.

For many years I used the Office11 version, stable and so far the fastest one. About two years ago I switched to Office12, marginally slower but has a few features more. So far it's pretty stable (I use it several hours every day). It comes with the free Excel viewer - officially retired by M$ but available on several dedicated sites.

Later versions may offer more bells and whistles, but prepare for crashes.
Title: Re: Msftedit.dll
Post by: aw27 on June 04, 2019, 09:43:35 PM
Quote from: jj2007 on June 04, 2019, 08:41:42 PM
Quote from: AW on June 04, 2019, 07:49:03 PMDon't use the MS Office riched20.dll until Mr. Murray starts documenting things properly instead of producing useless marketing blogs.

For many years I used the Office11 version, stable and so far the fastest one. About two years ago I switched to Office12, marginally slower but has a few features more. So far it's pretty stable (I use it several hours every day). It comes with the free Excel viewer - officially retired by M$ but available on several dedicated sites.

Later versions may offer more bells and whistles, but prepare for crashes.

Office 11 is Office 2003 and Office 12 is Office 2007. I am talking about more recent stuff.
Title: Re: Msftedit.dll
Post by: TimoVJL on June 04, 2019, 10:17:20 PM
16.0.8xxx series was the last "normal" dll, that was able to load rtf-files normally ?
Title: Re: Msftedit.dll
Post by: jj2007 on June 04, 2019, 10:28:40 PM
Quote from: AW on June 04, 2019, 09:43:35 PMOffice 11 is Office 2003 and Office 12 is Office 2007. I am talking about more recent stuff.

I know. The point is that the Office11+12 RichEd20.dll are freeware.
Title: Re: Msftedit.dll
Post by: TimoVJL on June 04, 2019, 10:43:58 PM
Quote from: AW on June 04, 2019, 07:49:03 PM
The solution from the link above works, except for icons (I can't figure out what is missing).
change \wmetafile1 to \wmetafile8 and try again.

Microsoft Access 2016 Runtime (https://www.microsoft.com/en-us/download/details.aspx?id=50040) ?
Title: Re: Msftedit.dll
Post by: aw27 on June 05, 2019, 01:22:25 AM
Thank you Timo, wmetafile8 allows to see the icon (although in blue color). However, after replacing 60 wmetafile1 with wmetafile8, image bullets and hotspots are not seen in Word anymore.  :sad:

I don't use access databases since long.
Title: Re: Msftedit.dll
Post by: aw27 on June 05, 2019, 01:28:02 AM
Quote from: jj2007 on June 04, 2019, 10:28:40 PM
Quote from: AW on June 04, 2019, 09:43:35 PMOffice 11 is Office 2003 and Office 12 is Office 2007. I am talking about more recent stuff.

I know. The point is that the Office11+12 RichEd20.dll are freeware.

Sure, old freeware. The point is old. I did not know any version of Office was free, are you a student? If are not free how can we get their RichEd20.dll? Not that I am interested, I have all that crap on DVDs.
Title: Re: Msftedit.dll
Post by: jj2007 on June 05, 2019, 02:59:39 AM
Quote from: AW on June 05, 2019, 01:28:02 AMI did not know any version of Office was free

The Office11 and Office12 RichEd20.dlls are free because they come with the free Word and Excel viewers.
Title: Re: Msftedit.dll
Post by: aw27 on June 05, 2019, 03:30:38 AM
I exported to RTF not using WMF (all converted to bitmap). Now everything is great. Bottom line: WMF handling is somewhat messy within Word. It appears that with Wordpad is even worse (can't read wmetafile1, only wmetafile8). With riched20.dll take your conclusions.

(https://www.dropbox.com/s/8bq06crstjwomhz/loadrtf2.jpg?dl=1)

I include the new RTF for people that want to test.

@JJ
Thank you.

Title: Re: Msftedit.dll
Post by: jj2007 on June 05, 2019, 04:54:04 AM
Just tested the Office16 version that comes with the Access runtime. It crashes if it doesn't find the matching MSPTLS.DLL, but it works fine if it does. It even displays automagically embedded images - see attachment!

Minor negative point: With some files, it loads 20 times slower than the Office11/12 versions. No problem for hello world sources, of course.

Second minor negative point: No images displayed when opening José's example file :sad:

Third minor negative point: It opens Word2007RTFSpec_1.9.rtf very, very fast, but only the first page gets loaded :tongue: