Board index » cppbuilder » how to pass multiple arguments through a tagSAFEARRAY** ?

how to pass multiple arguments through a tagSAFEARRAY** ?


2005-06-20 07:11:41 PM
cppbuilder38
I have this object that i imported, that can have a series of strings as
arguments, but bcb wants it in a tagSAFEARRAY** ...
From this other post i read on this newsgroup I experimented a bit with
VARIANTOBJ which has a conversion thingie, which compiled but then
resulted in an error during runtime.
How would i go about passing multiple strings to this object?
current code:
AnsiString cmdLine = "stringone stringtwo stringthree" ;
VARIANTOBJ olecmd = cmdLine.c_str() ; // this is only one string..
// i need
to find a way to pass multiple strings.I'm not even sure if this is correct
for one string
FrmMain->OleObject->OleFunction(&olecmd.parray) ; // this would be
FrmMain->OleObject->OleFunction("string one", "string two", "string three")
// if it didn't need that tagSAFEARRAY** ...
FrmMain->OleObject->Connect() ;
I prolly got it all wrong. I never used any activex in bcb before :p
 
 

Re:how to pass multiple arguments through a tagSAFEARRAY** ?

I have this object that i imported, that can have a series of strings as
arguments, but bcb wants it in a tagSAFEARRAY** ...
From this other post i read on this newsgroup I experimented a bit with
VARIANTOBJ which has a conversion thingie, which compiled but then
resulted in an error during runtime.
How would i go about passing multiple strings to this object?
current code:
AnsiString cmdLine = "stringone stringtwo stringthree" ;
VARIANTOBJ olecmd = cmdLine.c_str() ; // this is only one string..
// i need
to find a way to pass multiple strings.I'm not even sure if this is correct
for one string
FrmMain->OleObject->OleFunction(&olecmd.parray) ; // this would be
FrmMain->OleObject->OleFunction("string one", "string two", "string three")
// if it didn't need that tagSAFEARRAY** ...
FrmMain->OleObject->Connect() ;
I also tried:
char* strl[2] ;
strl[0] = "string one" ;
strl[1] = "string two" ;
strl[2] = "string three" ;
VARIANTOBJ oleobj = strl ;
FrmMain->OleObject->OleFunctiont(&oleobj.parray) ;
FrmMain->OleObject->Connect() ;
which also resulted in runtime errors...
I prolly got it all wrong. I never used any activex in bcb before :p