GetLongValue Example for C++ 6.0 and later
void CDicomDlg::TestProc4()
{
long lCount;
long x;
short nRet;
m_pLEADDicomDS->EnableMethodErrors = FALSE;
//move to the root element
m_pLEADDicomDS->ResetDS ();
m_pLEADDicomDS->FindTag(TAG_HISTOGRAM_DATA);
nRet = m_pLEADDicomDS->InsertElement ( FALSE,
TAG_HISTOGRAM_DATA,
m_pLEADDicomDS->GetCurrentTag ()->VR,
FALSE,
ELEMENT_INDEX_MAX);
if(nRet != 0)
{
AfxMessageBox("Error Inserting Element");
return;
}
//insert some short values into the element
m_pLEADDicomDS->LongValueCount= 5;
for(x=0; x<5; x++)
{
m_pLEADDicomDS->LongValues [x] = x*100000;
}
//set the shorts
nRet = m_pLEADDicomDS->SetLongValue(5);
if(nRet != 0)
{
AfxMessageBox("Error");
return;
}
m_pLEADDicomDS->LongValueCount = 0; //free the values
//get the value count
lCount = m_pLEADDicomDS->GetValueCount ();
CString szOut;
szOut.Format("There are %ld values!", lCount);
AfxMessageBox(szOut);
//get the values
szOut.Empty();
CString strResult;
nRet = m_pLEADDicomDS->GetLongValue (0, lCount);
if(nRet == 0)
{
for(x=0; x<m_pLEADDicomDS->GetLongValueCount (); x++)
{
szOut.Format("%ld\n", m_pLEADDicomDS->GetLongValues (x));
strResult+=szOut;
}
}
AfxMessageBox(strResult);
}