473,372 Members | 836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.


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

please help!!!
Mar 14 '08 #1
3 14540
9,208 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,208 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

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

Similar topics

by: Flzw | last post by:
How to convert a std::string to a WCHAR* ? is there any methods or something ? I can't find. Thanks
by: centrino | last post by:
hi, I import a funtion fromm dll file: dll function header : DWORD WINAPI Enumerate( HANDLE hWDMHandle, PNDIS_STATUS pNStatus,
by: sweety | last post by:
Dear all, Kindy help to convert the char* ( LPCSTR) to WCHAR*(LPCWSTR). Would be great if you tell if any function does this job in VC++. Quick response will be greatfull...as its blocked... ...
by: Egbert Nierop \(MVP for IIS\) | last post by:
In win32 mode, a BSTR was UINT length prefixed and terminated exactly by a zero char. So if you allocated "Hello World" that would allocate 28 bytes. In x64 and (IA64 as well) it would become...
by: babu17 | last post by:
hi, i have an asp page which creates a object using server.createobject and uses its method. example: set obj1= server.createobject("test.test") ' test is a dll tmp = obj1.method() ' it...
by: MattWilson.6185 | last post by:
Hello! I am trying to convert a char * to a LPWSTR, and I am going absolutly mad! I can't find anything besides typle L"string" Unfortunetaly I can't use that... basicaly the setup is ...
by: sandeepkavade | last post by:
hi all i want to convert wstrint to WCHAR* how to do that? i am getting following error: error C2664: 'UnicodeToUtf8' : cannot convert parameter 1 from 'std::wstring *__w64 ' to 'const WCHAR *'
by: Abhishek | last post by:
how do i convert LPWSTR to LPTSTR thanks in advance for helping regards Abhishek
by: nabil035 | last post by:
this is my code: BSTR A; //I put data in A and I test it through a message box and all things are alright MyFunction(A); //I have an error in my function
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.