BSTR and VARIAN types...

2004-02-25 09:13:28 PM
Hi there!
I'm using ActiveX component for one system, where can be connected with
special RCP protocol. This system send back replys and they appear to RCP
event handler, where reply data can be found.
I'm not very familiar with these types and now i have problem.
I have sample code from this system supppiler, what is for VisualC++.
Here is snip from that sample code:
bool __fastcall TForm::OnRCPReceive(TObject *Sender, TVariant RCP){
long i;
BYTE * pbytes;
LONG cElements, lLBound, lUBound;
VARIANT* pVariant;
// Type check VARIANT parameter. It should contain a BSTR array
// passed by reference. The array must be passed by reference it is
// an in-out-parameter.
if (RCP.vt == (VT_ARRAY | VT_UI1))
psa = RCP.parray;
if(psa == NULL)
return FALSE;
// Check dimensions of the array.
if (SafeArrayGetDim(psa) != 1)
return FALSE;
My problem is that this line:
if (RCP.vt == (VT_ARRAY | VT_UI1))
It is always false. Can someone say why? Is there something different
between Visual and BCB in this case?
Thank you!