InsertTag Example for C++ 6.0 and later
short nRet;
ILEADDicomTagPtr pCurrentTag=NULL;
int nIndex;
CString szItem;
nRet = m_pLEADDicomDS->FindTag(131079);
if(nRet == 0)
{
AfxMessageBox("Already Exists!");
return;
}
nRet = m_pLEADDicomDS->InsertTag (131079, -1, "My Test Tag", VR_OB, 1, 1, 1);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
//add item to the ListView control
pCurrentTag = m_pLEADDicomDS->GetCurrentTag ();
szItem.Format("%04X:%04X", GETGROUP(pCurrentTag->GetCode()),
GETELEMENT(pCurrentTag->GetCode()));
nIndex = m_ListView1.InsertItem(m_ListView1.GetItemCount(), szItem);
szItem.Format("%04X:%04X", GETGROUP(pCurrentTag->GetMask()), GETELEMENT(pCurrentTag->GetMask()));
m_ListView1.SetItemText(nIndex, 1, szItem);
BSTR bstr = pCurrentTag->GetName();
szItem = bstr;
SysFreeString(bstr);
m_ListView1.SetItemText(nIndex, 2, szItem);
szItem.Format("%d", pCurrentTag->GetVR());
m_ListView1.SetItemText(nIndex, 3, szItem);
szItem.Format("%d", pCurrentTag->GetMinVM());
m_ListView1.SetItemText(nIndex, 4, szItem);
szItem.Format("%d", pCurrentTag->GetMaxVM());
m_ListView1.SetItemText(nIndex, 5, szItem);
szItem.Format("%d", pCurrentTag->GetDivideVM());
m_ListView1.SetItemText(nIndex, 6, szItem);
m_ListView1.SetItemState(nIndex, LVIS_SELECTED, LVIF_STATE);
m_ListView1.Update(nIndex);