NO

Author Topic: Partially working InvokeHelper code generator.  (Read 3731 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Partially working InvokeHelper code generator.
« on: November 21, 2017, 12:29:42 PM »
Partially working InvokeHelper code generator for C.
It needs lot of fixing, but can create a templates for functions/methods.

Create code like this:
Code: [Select]
int _DSynMhAtx_AddPolyLine(IDispatch *pDisp,BSTR strObjectName,short nPts,float* x,int bClosed)
{
        if (!pDisp) return;
        DISPPARAMS dp;
        VARIANT vResult;
        VariantInit(&vResult);
        VARIANT vParams[4];
        vParams[3].vt = VT_BSTR;
        vParams[3].bstrVal = strObjectName;
        vParams[2].vt = VT_I2;
        vParams[2].iVal = nPts;
        vParams[1].vt = VT_R4 | VT_BYREF;
        vParams[1].pfltVal = x;
        vParams[0].vt = VT_I4;
        vParams[0].intVal = bClosed;
        dp.cNamedArgs = 0;
        dp.rgdispidNamedArgs = NULL;
        dp.cArgs = 4;
        dp.rgvarg = &vParams[0];
        pDisp->lpVtbl->Invoke(pDisp, 0x33, &IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_METHOD, &dp, &vResult, NULL, NULL);
        //SysFreeString(vParams[3].bstrVal);
        return vResult.intVal;
}
Hopefully it helps someone with similar issues.
« Last Edit: November 21, 2017, 06:52:06 PM by TimoVJL »
May the source be with you

Jokaste

  • Guest
Re: Partially working InvokeHelper code generator.
« Reply #1 on: November 21, 2017, 08:55:09 PM »
I have downloaded and executed your program.
What is the goal?
Is it for creating an interface dor COM (or equivalent) ?
 ???

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: Partially working InvokeHelper code generator.
« Reply #2 on: November 21, 2017, 09:10:10 PM »
Visual C++ can create InvokeHelper() wrappers for IDispatch.
I just needed a similar for C as SynRad OCX vtable don't work for me :(
Normally vtable is better and faster for normal usage.
May the source be with you