How can a c++ method pass a string with some null characters (chr(0)) to a Visual Basic application. When i use a CString variable, the string i want to send to VB is cutted at the chr(0) character.
Have you tried to pas a:
#define nullString \x00
- you can pass other character instead (printable or not printable)- and convert it hten in VB
- or you could shift your characters chrs few position to the right and do the reverse way in VB.
Anyway the target String from VB you should first alloc with
Dim MyString$
MyString = Space$(Len(MyString))
Hope this helps,
s-)
Blessed is he who in the name of justice and good will, shepards the week through the valley of darkness...
The VB application is an ocx and i can't add codelines in this vb application. In fact, the program ran well with C 16 bits and VB3 but since all was migrated in Visual C++ 5 and VB6, the strings with null charcaters are cutted.
Oh, you can pass to VB only BSTR. They have in a character two bytes instead of one. So one character is unsigned short, and the string will be unsigned short* or wchar_t*, or BSTR.
wchar_t* bstring = L"HELLO";//pay attention on L
char* cstring = "hello"; John Fill
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.