alex_registry
asked on
BSTR <-> char* conversions using C++ class
Hi all,
I tried to find the article where Don Box discusses many variations of
BSTR <-> char* conversion. I desperately need it.
Can any one send me that article from MSJ August 1995 Interfaces and the Registry/GetActiveObject Vs. MFC?
Anybody has code (C++ class) on this topic?
Thanks a lot.
I tried to find the article where Don Box discusses many variations of
BSTR <-> char* conversion. I desperately need it.
Can any one send me that article from MSJ August 1995 Interfaces and the Registry/GetActiveObject Vs. MFC?
Anybody has code (C++ class) on this topic?
Thanks a lot.
The article:
MSJ August, 1995 - Interface Enumeration/GetActiveObjec t vs. MFC
Can be found at:
http://www.microsoft.com/MSJ/0895/activex0895.htm
MSJ August, 1995 - Interface Enumeration/GetActiveObjec
Can be found at:
http://www.microsoft.com/MSJ/0895/activex0895.htm
ASKER
I had visited all links you posted. I would like to see C++ functions that deal with these conversions.
Anyway, I really appreciate your effort. Thanks a lot.
Alex
Anyway, I really appreciate your effort. Thanks a lot.
Alex
The actual function to do the conversion is the Win32 API function WideCharToMultiByte.
Alex,
I guess that you must be debating who to award the points to.
You should award them to the person who best answered your question. If that person was Chensu, then award them to him. If it was me, then reject Chensu's answer and accept my comment.
If you aren't sure, then just give them to Chensu since he answered first.
I guess that you must be debating who to award the points to.
You should award them to the person who best answered your question. If that person was Chensu, then award them to him. If it was me, then reject Chensu's answer and accept my comment.
If you aren't sure, then just give them to Chensu since he answered first.
ASKER
Does any one has a class solution?
ASKER
Adjusted points from 200 to 245
ASKER
char* <-> BSTR
wchar_t* <-> BSTR
char* <-> wchar_t*
So, there should be 6 conversions covered be this class(es).
alex_registry
wchar_t* <-> BSTR
char* <-> wchar_t*
So, there should be 6 conversions covered be this class(es).
alex_registry
The _bstr_t class is exactly what you want. The source code is in the comutil.h file.
ASKER
Adjusted points from 245 to 440
ASKER
I wanna a class. Class please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Answer accepted
String Conversion Macros
http://msdn.microsoft.com/library/default.asp?URL=/library/devprods/vs6/visualc/vcmfc/_atl_string_conversion_macros.htm
TN059: Using MFC MBCS/Unicode Conversion Macros
http://msdn.microsoft.com/library/default.asp?URL=/library/devprods/vs6/visualc/vcmfc/_mfcnotes_tn059.htm
You may also use the _bstr_t class that has the _bstr_t::wchar_t* and _bstr_t::char* operators if you are using Visual C++ 5.0 or later.
The MSJ August 1995 source code can be downloaded at
http://www.microsoft.com/msj/code1993to1997/MSJAUG95.EXE