Hi everyone,
I am calling a method in a COM dll that as the first parameter takes a VARIANT of type VT_INT (actually it has to be like a VARIANT array of (1,0,0), see the following code for more clarification). I am trying to make it work in C++. I have the equivalent working VB code which is likein the following code pM is the pointer to an interface)
dim XVect
XVect = pM.RotateVector(Array(1, 0, 0))
and it works perfect, i.e the Array function in VB does the trick.
Now in C++, I am trying this:
_variant_t var;
VariantInit(&var);
var.vt = VT_ARRAY | VT_INT;
var.parray= (1,0,0);
//pM is a smart pointer to an interface
pM->RotateVector(&var);
But I am getting an Unknown error on the last line (I have tried it with VARIANT instead of _variant_t as well). Any ideas of what I am doing wrong here? I thought maybe I have to first put my array of (1,0,0) in a safeArray and then assign the safearray to var.parray before passing var to the function. Am I way off?
Appreciate any comments.
onlyshiza
I am calling a method in a COM dll that as the first parameter takes a VARIANT of type VT_INT (actually it has to be like a VARIANT array of (1,0,0), see the following code for more clarification). I am trying to make it work in C++. I have the equivalent working VB code which is likein the following code pM is the pointer to an interface)
dim XVect
XVect = pM.RotateVector(Array(1, 0, 0))
and it works perfect, i.e the Array function in VB does the trick.
Now in C++, I am trying this:
_variant_t var;
VariantInit(&var);
var.vt = VT_ARRAY | VT_INT;
var.parray= (1,0,0);
//pM is a smart pointer to an interface
pM->RotateVector(&var);
But I am getting an Unknown error on the last line (I have tried it with VARIANT instead of _variant_t as well). Any ideas of what I am doing wrong here? I thought maybe I have to first put my array of (1,0,0) in a safeArray and then assign the safearray to var.parray before passing var to the function. Am I way off?
Appreciate any comments.
onlyshiza