Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
Convert BSTR(OLECHAR*) to LPWSTR (WCHAR)???
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
nabil035
New Member
Join Date:
Mar 2008
Posts:
34
#1
Convert BSTR(OLECHAR*) to LPWSTR (WCHAR)???
Mar 14 '08, 11:20 AM
I want to convert in my COM server a BSTR var into LPWSTR
please help!!!
weaknessforcats
Recognized Expert
Expert
Join Date:
Mar 2007
Posts:
9214
#2
Mar 14 '08, 04:32 PM
Have you tried WideCharToMulti Byte() ?
Comment
Post
Cancel
nabil035
New Member
Join Date:
Mar 2008
Posts:
34
#3
Mar 19 '08, 04:29 PM
well sorry it's so simple to convert it
just I used this code
USES_CONVERSION ;
lpwstr wchar = T2W(bstrvar);
;)
Comment
Post
Cancel
weaknessforcats
Recognized Expert
Expert
Join Date:
Mar 2007
Posts:
9214
#4
Mar 19 '08, 05:10 PM
Originally posted by
nabil035
lpwstr wchar = T2W(bstrvar);
That's an ATL macro.
Here's a quote from Microsoft:
Originally posted by
MSDN
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
.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment