Error when passing a BSTR* to an ActiveX component
Hi,
I have an activeX component written in Visual Basic 6.0. My problem is when
I try to use a method in that ActiveX component. The method has two
parameters, one short* and one BSTR*, the short pointer works OK but the
BSTR pointer is somehow set to NULL inside the "wrapper class" that
implements the ActiveX component. I'm using BSB 5 to access the component.
Here is the code that allocates the BSTR and uses the method in the ActiveX
component: TISMPumpIconView is the class for the ActiveX component and
addStackFilling is the method that the problem occurs in.
BSTR strAmount = ::SysAllocString(L"200");
short nStackIndex;
nStackIndex = 1;
if (FNumOfPumps < MAX_PUMPS)
{
FPumpIcons[FNumOfPumps] = new TISMPumpIconView(this);
FPumpIcons[FNumOfPumps]->Parent = pPump;
FPumpIcons[FNumOfPumps]->OnMouseDown = PumpIconMouseDown;
FPumpIcons[FNumOfPumps]->Top = (FNumOfPumps / 9) * 80+8;
FPumpIcons[FNumOfPumps]->Left = (FNumOfPumps % 9) * 80+8;
FPumpIcons[FNumOfPumps]->PumpNr = IntToStr(FNumOfPumps + 1);
FPumpIcons[FNumOfPumps]->PumpState = 30;
FPumpIcons[FNumOfPumps]->addStackFilling(&nStackIndex,
&strAmount);
FNumOfPumps++;
}
SysFreeString(strAmount);
Here is the code that implements the method in the ActiveX component:
void __fastcall TISMPumpIconView::addStackFilling(short*
stackIndex/*[in,out]*/,
BSTR*
fillAmount/*[in,out]*/)
{
GetDefaultInterface()->addStackFilling(stackIndex/*[in,out]*/,
fillAmount/*[in,out]*/);
Could someone please help me and tell me what I am doing wrong?
Best regards
Maria