Pregunta

I am trying to access lync from my application in this code I am getting errors.

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

My code is as follows:

 #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();
  }
¿Fue útil?

Solución

ToString() is returning a managed System::String type. This is different from the unmanaged std::string type.

To convert from one to the other, use marshal_as.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top