GetPresentationCount Example for Visual Basic
Dim x As Long
Dim id As Integer
Dim maxid As Integer
Dim out$
'create the Associate Class as Request
LEADDICOMNet1.CreateAssociate True
'set the Associate to the default
LEADDICOMNet1.DefaultAssociate LEADDICOMNet1.hPDU
'get current id's and display them
out$ = ""
maxid = 0
For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
id = LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, x)
out$ = out$ & id
out$ = out$ & Chr(13)
'store the highest id
If id > maxid Then maxid = id
Next
MsgBox out$
id = maxid + 2 'id must be unique and odd number
'change the some ids and then display them all
For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
LEADDICOMNet1.SetPresentationID LEADDICOMNet1.hPDU, x, id
id = id + 2 'id must be odd number
Next
out$ = ""
For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
out$ = out$ & LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, x)
out$ = out$ & Chr(13)
Next
MsgBox out$
'add a presentation context
out$ = ""
LEADDICOMNet1.AddPresentation LEADDICOMNet1.hPDU, 1, PDU_ACCEPT_RESULT_SUCCESS, UID_CT_IMAGE_STORAGE
For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
out$ = out$ & LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, x)
out$ = out$ & Chr(13)
Next
MsgBox out$
'delete the one we added
out$ = ""
LEADDICOMNet1.DeletePresentation LEADDICOMNet1.hPDU, 1
For x = 0 To LEADDICOMNet1.GetPresentationCount (LEADDICOMNet1.hPDU) - 1
out$ = out$ & LEADDICOMNet1.GetPresentationID (LEADDICOMNet1.hPDU, x)
out$ = out$ & Chr(13)
Next
MsgBox out$
LEADDICOMNet1.FreeAssociate LEADDICOMNet1.hPDU