NO

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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1777
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

Offline Jokaste

  • Member
  • *
  • Posts: 148
  • Never be pleased, always improve.
    • ImgTools
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) ?
 ???
Kenavo

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1777
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