RichEdit OLE tests

Started by TimoVJL, April 29, 2025, 04:08:00 PM

Previous topic - Next topic

TimoVJL

Quote from: Quin on April 28, 2025, 05:37:31 PMHi John Z,
That's true, simple COM like this is doable in pure C. Sadly not all COM is easily doable though, for example I wanted to call the ITextServices COM interface using <textserv.h> as seen in this Stack Overflow post, but that header is C++ only and I couldn't manage to wrap it in C and have it still work  :'(
In Pelles C
    // OLE
    SendMessage(hREdit, EM_GETOLEINTERFACE, 0, (LPARAM)&pRichEditOle);
    if (pRichEditOle) {
        HRESULT hr = pRichEditOle->lpVtbl->QueryInterface(pRichEditOle, &IID_ITextDocument2, (void **)&pTextDocument);
        if (pTextDocument)
            printf("pTextDocument %p \n", pTextDocument);
        hr = pRichEditOle->lpVtbl->QueryInterface(pRichEditOle, &IID_ITextServices, (void **)&pTextServices);
        if (pTextServices) {
            printf("pTextServices %p \n", pTextServices);
            pTextServices->lpVtbl->OnTxPropertyBitsChange(pTextServices, TXTBIT_ALLOWBEEP, 0);
            pTextServices->lpVtbl->Release(pTextServices);
        }
    }
    //
32-bit version crash, don't know why.
May the source be with you

Quin

Wow Timo, you're an absolute wizard! Thanks for this, that's super neat!
Use the assembly, Luke.