GetApplication Example for C++ 6.0 and later

{
   CString strMsg;
   
   //Create the associate
   m_pLEADDicomNet->CreateAssociate(TRUE);
   
   //Getthe current Application Context
   _bstr_t sApplicationContext = m_pLEADDicomNet->GetApplication(m_pLEADDicomNet->GethPDU());
   strMsg.Format("Current Application Context: %s", (char *)sApplicationContext );
   AfxMessageBox(strMsg);
   
   //change it
   _bstr_t sApplicationContextNew = "9.9.999.99999.9.9.9.9";
   m_pLEADDicomNet->SetApplication (m_pLEADDicomNet->GethPDU(), sApplicationContextNew);


   sApplicationContext = m_pLEADDicomNet->GetApplication(m_pLEADDicomNet->GethPDU());
   strMsg.Format("New Application Context %s", (char *)sApplicationContext);
   AfxMessageBox(strMsg);
   
   //Free associate
   m_pLEADDicomNet->FreeAssociate( m_pLEADDicomNet->GethPDU());
}