我正在尝试通过此代码从应用程序访问lync,但出现错误。
error C3699: '^' : cannot use this indirection on type 'std::string'
error C2440: 'initializing' : cannot convert from 'System::String ^' to 'std::string *'
1> No user-defined-conversion operator available, or
1> Cannot convert a managed type to an unmanaged type
我的代码如下:
#using <Microsoft.Lync.Model.dll>
#using <Microsoft.Lync.Utilities.dll>
//namespace provided that DLL
using namespace Microsoft::Lync::Model;
//Function which is using that DLL
void getusername()
{
LyncClient ^lyncClient;
string ^text=lyncClient->Self->Contact->GetContactInformation(ContactInformationType::DisplayName)->ToString();
}
ToString()
返回托管System::String
类型。这与非托管std::string
类型不同。
要从一个转换为另一个,请使用marshal_as。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句