Pelles C forum

C language => Tips & tricks => Topic started by: TimoVJL on October 31, 2018, 05:18:08 pm

Title: Richedit tips
Post by: TimoVJL on October 31, 2018, 05:18:08 pm
Missing TOM.h ?
You can create it from riched20.dll / msftedit.dll and rename it to tom.h

After that you can
Code: [Select]
SendMessage(hREdit, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle);
HRESULT hr = pRichEditOle->lpVtbl->QueryInterface(pRichEditOle, &IID_ITextDocument, (void **)&pDocument);
and
Code: [Select]
VARIANT v;
v.vt = VT_BSTR;
v.bstrVal = SysAllocString(szFileName);
HRESULT hr = pDocument->lpVtbl->Open(pDocument, &v, 0x30, 0); // 0x30 tomOpenExisting
SysFreeString(v.bstrVal);
EDIT: Windowless RE with msftedit.dll 32-bit, by faking __thiscall with __fastcall :D