Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying Or converting a CByteArray into a VARIANT

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
I am trying to figure out how to pass out a Byte Array to visual basic I know the contructor for a COleVariant can take a byte array but it doesnt seem to be working and I dont know how to look at the debug information to see if it has received the information into it, this is the following sample code I am using.<br><br>VARIANT CSaFXCtrl::ByteS() <br>{<br> VARIANT vaResult;<br> VariantInit(&vaResult);<br> char s[15];<br> for ( int j=0; j&lt;13; j++)<br> s[j] = 'A';<br> s[13] = 'B';<br> s[14] = '\0';<br><br> CByteArray MyB;<br> for (int i=0; i&lt;15; i++)<br> MyB.Add((byte)s<i>);<br><br> COleVariant newV(MyB);<br> newV.ChangeType(VT_ARRAY ¦ VT_UI1);<br> VariantCopy(&vaResult, &newV);<br> return vaResult;<br>}<br><br> <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML, ASP(somewhat), QBasic(least i didnt start with COBOL)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top