GetUserInfoCount Example for Visual Basic
Dim x As Long
Dim y As Long
Dim nType As Integer
Dim nLen As Integer
Dim pData
Dim out$
Dim test
'create the Associate Class as Request
LEADDICOMNet1.CreateAssociate True
'set the Associate to the default
LEADDICOMNet1.DefaultAssociate LEADDICOMNet1.hPDU
'get current user info types, lengths, and data then display them
out$ = ""
If (LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) > 0) Then
For x = 0 To LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) - 1
nType = LEADDICOMNet1.GetUserInfoType (LEADDICOMNet1.hPDU, x)
out$ = out$ & "Type: " & CStr(nType)
nLen = LEADDICOMNet1.GetUserInfoLength(LEADDICOMNet1.hPDU, x)
out$ = out$ & " Length: " & CStr(nLen)
pData = LEADDICOMNet1.GetUserInfoData (LEADDICOMNet1.hPDU, x)
out$ = out$ & " Data: "
For y = 0 To nLen - 1
out$ = out$ & Chr(pData(y))
Next
out$ = out$ & Chr(13)
Next
Else
out$ = "None"
End If
MsgBox out$
'add a user info item item
out$ = ""
test = "just a test"
nLen = Len(test)
LEADDICOMNet1.AddUserInfo LEADDICOMNet1.hPDU, 99, test, Len(test)
out$ = ""
If (LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) > 0) Then
For x = 0 To LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) - 1
nType = LEADDICOMNet1.GetUserInfoType (LEADDICOMNet1.hPDU, x)
out$ = out$ & "Type: " & CStr(nType)
nLen = LEADDICOMNet1.GetUserInfoLength(LEADDICOMNet1.hPDU, x)
out$ = out$ & " Length: " & CStr(nLen)
pData = LEADDICOMNet1.GetUserInfoData (LEADDICOMNet1.hPDU, x)
out$ = out$ & " Data: "
For y = 0 To nLen - 1
out$ = out$ & Chr(pData(y))
Next
out$ = out$ & Chr(13)
Next
Else
out$ = "None"
End If
MsgBox out$
'for each user info item, change the data
test = "a second test"
For x = 0 To LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) - 1
nType = LEADDICOMNet1.GetUserInfoType (LEADDICOMNet1.hPDU, x)
LEADDICOMNet1.SetUserInfo LEADDICOMNet1.hPDU, x, nType, test, Len(test)
Next
out$ = ""
If (LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) > 0) Then
For x = 0 To LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) - 1
nType = LEADDICOMNet1.GetUserInfoType (LEADDICOMNet1.hPDU, x)
out$ = out$ & "Type: " & CStr(nType)
nLen = LEADDICOMNet1.GetUserInfoLength(LEADDICOMNet1.hPDU, x)
out$ = out$ & " Length: " & CStr(nLen)
pData = LEADDICOMNet1.GetUserInfoData (LEADDICOMNet1.hPDU, x)
out$ = out$ & " Data: "
For y = 0 To nLen - 1
out$ = out$ & Chr(pData(y))
Next
out$ = out$ & Chr(13)
Next
Else
out$ = "None"
End If
MsgBox out$
'delete the one we added
LEADDICOMNet1.DeleteUserInfo LEADDICOMNet1.hPDU, LEADDICOMNet1.GetUserInfoCount (LEADDICOMNet1.hPDU) - 1
LEADDICOMNet1.FreeAssociate LEADDICOMNet1.hPDU