r/visualbasic • • Aug 06 '24

VB6 Help TOM2

I've been trying to figure out how to access TOM2. (text object model) Very confusing. OLEView shows it in riched20.dll, even though I asked it to load msftedit.dll. In the VB6 object browser I only get TOM1. (Also from riched20.) I can load msftedit.dll myself using LoadTypeLibEx and I see the TOM2 objects, but I can't seem to get VB to see it, and the DLL lacks a DLLRegisterServer function. None of what I want seems to be hidden or restricted. I tried using Res Hacker to extract the typelib from msftedit.dll, but that also won't load.

Does anyone know how to get at this? I was thinking of writing an RTF to HTML converter. Apparently TOM2 can do the conversion. But somehow objects like TextRange2 don't seem to be accessible.

3 Upvotes

9 comments sorted by

View all comments

Show parent comment

2

u/JTarsier Aug 07 '24

It seems that the functionality may be blocked unless MSOffice is installed.

That is likely it, article says:

we have added HTML copy/paste, images, and math (of course!) to the Microsoft Office riched20.dll

In comment for another article https://devblogs.microsoft.com/math-in-office/richedit-font-binding/ he writes:

Many recent RichEdit enhancements only appear in the Microsoft Office riched20.dll. The RichEdit HTML reader uses the Office HTML parser so it isn’t likely to be ported to the msftedit.dll in the near future.

Apart from that I can confirm EM_STREAMOUT works to html on my system that has Office installed.

2

u/Mayayana Aug 07 '24

Interesting. I guess I just assumed that if I found the right trick then it would work. I tried both riched20 and msftedit on Win10. Only msftedit has tom2 in its typelib when I load the typelibs directly from the files. But maybe I'm not missing much, as OK_Society noted. I've seen what passes for HTML generated by MS Word.