楼上方法我早用过啦 error C2440: '=' : cannot convert from 'unsigned short *' to 'unsigned short ** ' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
MSDN明说了//typedef CStringT< TCHAR, StrTraitATL< TCHAR > > CAtlString;CAtlString str("Soccer is best!"); BSTR bstr = str.AllocSysString();// bstr now contains "Soccer is best!", and can be // passed to any OLE function requiring a BSTR. // Normally, if you pass the BSTR, you will // need to free the string after returning from the function call.
error C2440: '=' : cannot convert from 'unsigned short *' to 'unsigned short ** '
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
BSTR bstr = str.AllocSysString();// bstr now contains "Soccer is best!", and can be
// passed to any OLE function requiring a BSTR.
// Normally, if you pass the BSTR, you will
// need to free the string after returning from the function call.
AllocSysString返回的是BSTR类型
你的是指针的指针
所以
BSTR FAR* strServerName=new BSTR;
*p = str1.AllocSysString();