GetDateValue Example for C++ 6.0 and later
void CDicomDlg::TestProc9()
{
long lCount;
short nRet;
IDATEVALUEItemPtr pDateValue=NULL;
m_pLEADDicomDS->EnableMethodErrors = FALSE;
//move to the root element
m_pLEADDicomDS->MoveFirstElement(FALSE);
m_pLEADDicomDS->MoveRootElement();
//insert a new element for the Date Values
nRet = m_pLEADDicomDS->InsertElement(FALSE, TAG_PATIENT_BIRTH_DATE, VR_DA, FALSE, 0);
//insert an Date value into the element
m_pLEADDicomDS->DateValueCount = 1;
pDateValue = m_pLEADDicomDS->GetDateValues(0);
pDateValue->Year = 1971;
pDateValue->Month = 12;
pDateValue->Day = 25;
//set the Date
nRet = m_pLEADDicomDS->SetDateValue (1);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
m_pLEADDicomDS->DateValueCount= 0; //free the value
//get the value count
lCount = m_pLEADDicomDS->GetValueCount ();
CString szOut;
szOut.Format("There are %ld values!", lCount);
AfxMessageBox(szOut);
//get the value
nRet = m_pLEADDicomDS->GetDateValue (0, lCount);
//display the value
pDateValue = m_pLEADDicomDS->GetDateValues (0);
szOut.Format("Year: %d\nMonth: %d\nDay: %d", pDateValue->GetYear(),pDateValue->GetMonth(),pDateValue->GetDay());
AfxMessageBox(szOut);
}