LDicomDS::GetConvertValue

Summary

Converts the value of an element to a string, and returns the number of characters in that string.

Syntax

#include "Ltdic.h"

L_UINT32 LDicomDS::GetConvertValue(pElement, Destination, DestSizeInWords)

Parameters

pDICOMELEMENT pElement

Pointer to a DICOMELEMENT structure within the Data Set.

L_TCHAR *Destination

Character string to be updated with the string version of the value.

L_UINT32 DestSizeInWords

Size of the Destination buffer.

Returns

Number of characters in the Destination parameter.

Comments

Call this function twice. The first should have Destination set to NULL. This will provide you with the size of the string that will be stored in Destination. Next, allocate the memory required for Destination and call this function again to update Destination with the string.

Required DLLs and Libraries

Platforms

Win32, x64

See Also

Functions

Topics

Example

This example converts the value to a string and display it in a list-box control.

L_INT LDicomDS_GetConvertValueExample(LDicomDS *pDS, pDICOMELEMENT pElement) 
{ 
   L_TCHAR* pszText; 
   L_TCHAR* p; 
   L_TCHAR* q; 
   L_UINT32 nLength; 
   L_UINT32 nCount; 
   L_UINT32 i; 
 
   nCount  = pDS->GetCountValue(pElement); 
   nLength = pDS->GetConvertValue(pElement, NULL, 0); 
   pszText = (L_TCHAR *)malloc(nLength * sizeof(L_TCHAR)); 
   pDS->GetConvertValue(pElement, pszText, nLength); 
 
   for (i = 0, p = pszText; i < nCount; i++) 
   { 
      q = wcschr(p, '\\'); 
      if (q != NULL) 
      { 
         *q++ = 0; 
      } 
 
      ::MessageBox(NULL, p, TEXT("Value"), MB_OK); 
 
      p = q; 
   } 
 
   free(pszText); 
   pDS->FreeValue(pElement); 
 
   return DICOM_SUCCESS; 
} 

Help Version 23.0.2024.7.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS DICOM C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.