Can't call C++ function in DLL from VB

I have a VB code that utilizes a couple of functions in a C++ DLL.  In one place my function call works in the other I get a "Compile Error: Invalid use of property" error.
Here is my VB code:

Private Sub ChangeItemNameValue_Click()
Dim itemName, itemValue As String

If TItemName.Text <> "" And TItemValue.Text <> "" Then
    itemName = TItemName.Text
    itemValue = TItemValue.Text
    Call ChangeItem(itemName, itemValue)    '<-------------- Here it works fine
Else
    MsgBox ("You must set the Item Name and Value")
End If
End Sub

Private Sub ChangeOrientation_Click()
Dim X1, X2, Y1, Y2 As String
If Tx1.Text <> "" And Tx2.Text <> "" And Ty1.Text <> "" And Ty2.Text <> "" Then
    X1 = Tx1.Text
    X2 = Tx2.Text
    Y1 = Ty1.Text
    Y2 = Ty2.Text
Call ChangeOrientation(X1, Y1, X2, Y2)        '<-------------- Here I get the error
Else
    MsgBox ("You must set all four cordinate values")
End If
End Sub

Here is my C++ code from the DLL for both:

__declspec(dllexport) _stdcall ChangeItem(BSTR itemName, BSTR itemValue)

{
     AFX_MANAGE_STATE(AfxGetStaticModuleState());

    LASER_PACKET                packet;
    PACKET_CHANGE_ITEM_VALUE    *itemP;
     USES_CONVERSION;
   
    packet.timestamp = getTimeDouble();
    packet.type      = LaserPacketChangeItemValue;
    itemP = (PACKET_CHANGE_ITEM_VALUE*)packet.dataP;

    strcpy(itemP->itemName, (OLE2A(itemName)));
    strcpy(itemP->itemValue, (OLE2A(itemValue)));
    tcpClientG.sendData((char*)&packet, sizeof(packet)-(MAX_COMMAND_SIZE-sizeof(PACKET_CHANGE_ITEM_VALUE)));
    currentCommandStatusG = LaserCommandPending;
}

__declspec(dllexport) void _stdcall ChangeOrientation(BSTR x1Cordinate, BSTR y1Cordinate, BSTR x2Cordinate, BSTR y2Cordinate)
{
     AFX_MANAGE_STATE(AfxGetStaticModuleState());

     LASER_PACKET                      packet;
    PACKET_CHANGE_ITEM_ORIENTATION    *itemP;
     USES_CONVERSION;

    packet.timestamp = getTimeDouble();
    packet.type      = LaserPacketChangeItemOrientation;
    itemP = (PACKET_CHANGE_ITEM_ORIENTATION*)packet.dataP;
    itemP->x1 = atoi(OLE2A(x1Cordinate));
    itemP->x2 = atoi(OLE2A(x2Cordinate));
    itemP->y1 = atoi(OLE2A(y1Cordinate));
    itemP->y2 = atoi(OLE2A(y1Cordinate));
    tcpClientG.sendData((char*)&packet, sizeof(packet)-(MAX_COMMAND_SIZE-sizeof  (PACKET_CHANGE_ITEM_ORIENTATION)));
    currentCommandStatusG = LaserCommandPending;

}
Any help would be greatly appreciated!

Thanks
axnst2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EDDYKTCommented:
change this

Dim itemName, itemValue As String

Dim X1, X2, Y1, Y2 As String


to

Dim itemName As String, itemValue As String

Dim X1 As String, X2 As String, Y1 As String, Y2 As String

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EDDYKTCommented:
by the way, how do you declare your function in VB?
0
aquila98Commented:
instead of the BSTR you might consider something like this
LONG __stdcall  CreateList(LPSTR  sListName);

in vb
Public Declare Function CreateList Lib "yourdllname.dll" Alias "?CreateList@@YGJPAD@Z" (ByVal sListName As String) As Long

Yuo need the fully decorated name which you get using dependency walker a tool of C++
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.