• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

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*/);
theApp.GetServerHandle()->GeneralBrowser(name);
...
 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
 
 
0
kim_wei
Asked:
kim_wei
1 Solution
 
andrewjbCommented:
"xxxxx" isn't a unicode string literal.

You need, say

_T("xxxxxx")
0
 
chensuCommented:
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
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now