GetTransferCount Example for Delphi

var
   x: Integer;
   strOut: String;
   result: String;
begin
   //create the Associate Class as Request
   LEADDICOMNet1.CreateAssociate (True);
   //set the Associate to the default
   LEADDICOMNet1.DefaultAssociate (LEADDICOMNet1.hPDU);
    
   //display each Transfer Syntax for the first Presentation Context
   strOut:= '';
   for x:= 0 to LEADDICOMNet1.GetTransferCount(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1 do
   begin
      result:= LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x);
      strOut:= strOut + result;
      strOut:= strOut + Chr(13);
   end;

   ShowMessage(strOut);
    
   //add a transfer syntax
   LEADDICOMNet1.AddTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), UID_IMPLICIT_VR_LITTLE_ENDIAN);
   //display each Transfer Syntax for the first Presentation Context
   strOut:= '';
   for x:= 0 To LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1 do
   begin
      result:= LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x);
      strOut:= strOut + result;
      strOut:= strOut + Chr(13);
   end;

   ShowMessage(strOut);
    
   //change them
   for x:= 0 to LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1 do
     LEADDICOMNet1.SetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x, UID_EXPLICIT_VR_BIG_ENDIAN);

   //display each Transfer Syntax for the first Presentation Context
   strOut:= '';
   for x:= 0 to LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1 do
   begin
     result:= LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x);
     strOut:= strOut + result;
     strOut:= strOut + Chr(13);
   end;
   ShowMessage(strOut);
    
   //delete the last one
   LEADDICOMNet1.DeleteTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1);
    
   //display each Transfer Syntax for the first Presentation Context
   strOut:= '';
   for x:= 0 to LEADDICOMNet1.GetTransferCount (LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0)) - 1 do
   begin
      result:= LEADDICOMNet1.GetTransferSyntax(LEADDICOMNet1.hPDU, LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, 0), x);
      strOut:= strOut + result;
      strOut:= strOut + Chr(13);
   end;
   
   ShowMessage(strOut);
    
   LEADDICOMNet1.FreeAssociate (LEADDICOMNet1.hPDU);
end;