Solved

pass unicode from COM client to COM server

Posted on 2004-03-24
2
312 Views
Last Modified: 2010-04-01
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
Comment
Question by:kim_wei
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Expert Comment

by:andrewjb
ID: 10669101
"xxxxx" isn't a unicode string literal.

You need, say

_T("xxxxxx")
0
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 10670400
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question