C++ Builder 5 AddMethod with Object's
I'm a C++ Builder 5 user....
See this usation:
....
Script->AddMethod("procedure CopyToSDF(source :TDataSet; filename:String)",(this)->SettiStruCallMethod,"ctOther","Saves a dataset in TXT file...");
...
On SettiStruCallMethod, method.....
.....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)Params.GetElement(0).ArrayLock(),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Variant is not Array" when CopyToSDF is used in Script.
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Does not Compile, ocours a erro "Cannot convert a Variant to TDataSet *)
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)&Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Access Violation" when CopyToSDF is used in Script.
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)(int)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Does not Compile, ocours a erro "Cannot convert a Int to TDataSet *)
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)(int *)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Access Violation" when CopyToSDF is used in Script.
Any Ideias????
Please help-me
[]'s from Brazil.
Egidio.
See this usation:
....
Script->AddMethod("procedure CopyToSDF(source :TDataSet; filename:String)",(this)->SettiStruCallMethod,"ctOther","Saves a dataset in TXT file...");
...
On SettiStruCallMethod, method.....
.....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)Params.GetElement(0).ArrayLock(),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Variant is not Array" when CopyToSDF is used in Script.
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Does not Compile, ocours a erro "Cannot convert a Variant to TDataSet *)
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)&Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Access Violation" when CopyToSDF is used in Script.
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)(int)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Does not Compile, ocours a erro "Cannot convert a Int to TDataSet *)
....
if (MethodName == "COPYTOSDF")
{
CopyToSDF((TDataSet *)(int *)Params.GetElement(0),(AnsiString)Params.GetElement(1));
}
Compile, and run but ocours runtime error "Access Violation" when CopyToSDF is used in Script.
Any Ideias????
Please help-me
[]'s from Brazil.
Egidio.