pass unicode from COM client to COM server

hello, all,

  A COM server (VC6.0) which requires a string with unicode characters from client (VC6.0), therefore I defined a BSTR variable in COM server interface. it looks like:

//COM server
CCNStServer::GeneralBrowser(BSTR name)

On client side, my code looks like:
//COM Client
_bstr_t name("xxxxxxx"/*unicode might be inside of this string*/);
 I found that only Ascii characters can be passed to COM server, I have no idea where  those unicode characters are!, anybody can help me?

thanx in advance
Who is Participating?
chensuConnect With a Mentor Commented:
Though "xxxxx" is an ANSI string, the constructor of _bstr_t is able to convert it to Unicode. To explicitly specify Unicode strings, use L"xxxxx". I don't think there is a problem. How do you know the Unicode strings are not working? Maybe you are debugging it without turning on Unicode?

Check the following option,

Menu Tools/Options..., Debug tab, Display unicode strings
"xxxxx" isn't a unicode string literal.

You need, say

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.

All Courses

From novice to tech pro — start learning today.