hi,
I get an error 27 call from the DLL saying that I pass an invalid number of argument to StaticVarSetText
In the manual I find it has 3 arguments (https://www.amibroker.com/guide/afl/staticvarsettext.html)
so I programmed:
AmiVar arg3[3];
arg3[0].type = VAR_STRING;
arg3[0].string = (char *)gSite.Alloc(100);
strcpy_s(arg3[0].string, 100, "startx");
strcat_s(arg3[0].string, 100, cid);
arg3[1].type = VAR_STRING; arg3[1].string = dtx.string;
arg3[2].type = VAR_FLOAT; arg3[2].val = 0.0f;
gSite.CallFunction("StaticVarSetText", 3, arg3);
it all seems OK. I thought maybe it gives me the wrong error, but if I comment out
gSite.CallFunction(“StaticVarSetText”, 3, arg3);
I do not get a run-time error. So it seems it does not accept 3 arguments. Anyone see a problem?
cid is a string passed as an argument to the function and dtx is defined as shown below,
thanks, Ed
AmiVar VempOnLButtonIsDown(int NumArgs, AmiVar *ArgsTable)
{
AmiVar arg1[1], arg2[2], arg3[3], arg4[4], cnt, result;
char *cid = ArgsTable[0].string;
float x = ArgsTable[1].val;
float y = ArgsTable[2].val;
arg1[0].type = VAR_STRING;
arg1[0].string = (char *)gSite.Alloc(100);
strcpy_s(arg1[0].string, 100, "oldx");
strcat_s(arg1[0].string, 100, cid);
AmiVar oldx = gSite.CallFunction("StaticVarGetText", 1, arg1);
arg2[0].type = VAR_FLOAT; arg2[0].val = x;
arg2[1].type = VAR_FLOAT; arg2[1].val = 0.0f;
AmiVar dtx = gSite.CallFunction("DateTimeToStr", 2, arg2);