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 (https://stackoverflow.com/questions/4683663/how-to-remove-annoying-beep-with-richtextbox), 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.
Wow Timo, you're an absolute wizard! Thanks for this, that's super neat!