converting a BSTR to a double.
Posted on 2004-11-08
Hi all. Here is my problem.
I am passing a string from VB into a C++ dll as a BSTR and now I have to pass it along as a double into a vendor's c++ app. The vendor's function won't execute properly. I was told that I might not be passing it the double right. The vendor tested his version of the client and it worked fine. This is what I did to convert my BSTR:
__declspec(dllexport) int _stdcall ChangeOrientation(BSTR x1Cordinate, BSTR y1Cordinate, BSTR x2Cordinate, BSTR y2Cordinate)
//Check to make sure we are still connected
packet.timestamp = getTimeDouble();
packet.type = LaserPacketChangeItemOrientation;
itemP = (PACKET_CHANGE_ITEM_ORIENTATION*)packet.dataP;
itemP->x1 = atoi((char*)x1Cordinate);
itemP->x2 = atoi((char*)x2Cordinate);
itemP->y1 = atoi((char*)y1Cordinate);
itemP->y2 = atoi((char*)y1Cordinate);
currentCommandStatusG = LaserCommandPending;
I think this should work fine but maybe I'm wrong. PLease let me know what you guys think.