InsertUID Example for C++ 6.0 and later
short nRet;
IDicomUIDItemPtr pCurrentUID=NULL;
int nIndex;
CString szItem;
nRet = m_pLEADDicomDS->FindUID("1.2.840.10008.1.3");
if(nRet == 0)
{
AfxMessageBox("Already Exists!");
return;
}
nRet = m_pLEADDicomDS->InsertUID ("1.2.840.10008.1.3", "My Test UID", DICOM_UID_TYPE_OTHER);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
//add item to the ListView control
pCurrentUID = m_pLEADDicomDS->GetCurrentUID ();
BSTR bstr = pCurrentUID->GetCode();
szItem = bstr;
SysFreeString(bstr);
nIndex = m_ListView1.InsertItem(m_ListView1.GetItemCount(), szItem);
bstr = pCurrentUID->GetName();
szItem = bstr;
SysFreeString(bstr);
m_ListView1.SetItemText(nIndex, 1, szItem);
m_ListView1.SetItemState(nIndex, LVIS_SELECTED, LVIF_STATE);
m_ListView1.Update(nIndex);