IsRoleSelect Example for C++ 6.0 and later
{
long i ;
short nID ;
CString strMsg ;
CString strTmp;
int nUser ;
int nProvider;
//create the Associate Class as Request
m_pLEADDicomNet->CreateAssociate (TRUE);
//set the Associate to the default
m_pLEADDicomNet->DefaultAssociate (m_pLEADDicomNet->GethPDU());
//indicate that we wish to serve as user for each SOP associated
for (i = 0; i < m_pLEADDicomNet->GetPresentationCount (m_pLEADDicomNet->GethPDU()); i++)
{
nID = m_pLEADDicomNet->GetPresentationID (m_pLEADDicomNet->GethPDU(), i);
m_pLEADDicomNet->SetRoleSelect( m_pLEADDicomNet->GethPDU(),
nID, TRUE,
PDU_ROLE_SUPPORT,
PDU_ROLE_NON_SUPPORT);
}
//now, display the information
strMsg = "Role Select Info\n";
for (i = 0; i < m_pLEADDicomNet->GetPresentationCount (m_pLEADDicomNet->GethPDU()); i++)
{
nID = m_pLEADDicomNet->GetPresentationID (m_pLEADDicomNet->GethPDU(), i);
strTmp.Format("ID[%d]\n", nID);
strMsg = strMsg + strTmp;
if (m_pLEADDicomNet->IsRoleSelect(m_pLEADDicomNet->GethPDU(), nID))
{
nUser = m_pLEADDicomNet->GetUserRole(m_pLEADDicomNet->GethPDU(), nID);
nProvider = m_pLEADDicomNet->GetProviderRole(m_pLEADDicomNet->GethPDU(), nID);
strTmp.Format("User[%d]\nProvider[%d]\n", nUser, nProvider);
strMsg = strMsg + strTmp;
}
else
{
strMsg = strMsg + "No Role Select\n";
}
}
AfxMessageBox(strMsg);
}