Hi
I can't send COM DLL's Bstr Type with c++
My Code is below(C#)
---------------------------------------------------------
//define Unmanaged Type
[MarshalAs(UnmanagedType.BStr)]
public String m_Bstr;
//an ellipsis
//Call
m_Bstr="test";
_Wrapper.VR_CreateTextObj(m_Bstr); <- this method receive BSTR type
------------------------------------------------------------
//a Result
m_Bstr="t"<--only 1st position of value sent.
If calling method with BSTR type parameter, value is wrong, only 1st
position of value sent.
-----------------------------------------------------------------------
VR_CreateTextObj method prototype..(made from c++)
------------------------
CreateTextObj(BSTR strText)
{
CString strLine;
strLine.Format("%s", strText);
AfxMessageBox(strLine);
}
advice me
thank you..
Mattias Sj?gren - 02 Sep 2004 21:19 GMT
>CreateTextObj(BSTR strText)
>
>{
>
> CString strLine;
> strLine.Format("%s", strText);
BSTRs generally contain wide characters, so you should use %S rather
than %s as the format specifier type.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.