InsertElement Example for C++ 6.0 and later
short nRet;
HTREEITEM hItem=NULL;
HTREEITEM hParent=NULL;
ILEADDicomTagPtr pCurrentTag=NULL;
IDicomDSElementPtr pCurrentElement=NULL;
m_pLEADDicomDS->FindTag(TAG_DISCHARGE_DATE);
pCurrentTag = m_pLEADDicomDS->GetCurrentTag ();
nRet = m_pLEADDicomDS->InsertElement (FALSE, TAG_DISCHARGE_DATE, pCurrentTag->GetVR(), FALSE, ELEMENT_INDEX_MAX);
if(nRet != 0)
AfxMessageBox("Error Inserting Element");
else
{
pCurrentElement = m_pLEADDicomDS->GetCurrentElement ();
//update the tree view
hParent = m_TreeView1.GetSelectedItem();
hItem = m_TreeView1.InsertItem(pCurrentTag->GetName(), hParent);
m_TreeView1.SetItemData(hItem, pCurrentElement->GethElement());
}