468,496 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,496 developers. It's quick & easy.


I want to convert in my COM server a BSTR var into LPWSTR

please help!!!
Mar 14 '08 #1
3 13854
9,207 Expert Mod 8TB
Have you tried WideCharToMultiByte() ?
Mar 14 '08 #2
well sorry it's so simple to convert it

just I used this code


lpwstr wchar = T2W(bstrvar);

Mar 19 '08 #3
9,207 Expert Mod 8TB
lpwstr wchar = T2W(bstrvar);
That's an ATL macro.

Here's a quote from Microsoft:
Note The recommended way of converting to and from BSTR strings is to use the CComBSTR class. To convert to a BSTR, pass the existing string to the constructor of CComBSTR. To convert from a BSTR, use COLE2[C]DestinationType[EX], such as COLE2T.
That is, do not use the macros.

More here: http://msdn2.microsoft.com/en-us/lib...a3(VS.71).aspx.
Mar 19 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by Flzw | last post: by
6 posts views Thread by centrino | last post: by
4 posts views Thread by sweety | last post: by
37 posts views Thread by Egbert Nierop \(MVP for IIS\) | last post: by
6 posts views Thread by MattWilson.6185 | last post: by
2 posts views Thread by Abhishek | last post: by
4 posts views Thread by nabil035 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.