r/visualbasic • u/Mayayana • 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.
View all comments
Show parent comment
2
u/Ok_Society4599 Aug 07 '24
Yeah, I think Word was always the converter between RTF and Html (and other formats). Maybe WordPad did it, too but, as I recall, all of that conversion was ... messy, to say the least.
You'd need to build at least one more stream decoder/encoder. I don't think RTF has a requirement on block ending markup, so you'd need a lot of fault tolerance (like browsers include) to cope with invalid streams. I'd guess that's why the "free apps" in Windows don't have features like that. And that's one of the motivations driving CSS -- take all that markup out of the document stream as far as possible.