SendCFindResponse Example for Visual Basic
Private Sub LEADDICOMNet1_NetReceiveCFindRequest(ByVal hNet As Long, ByVal nPresentationID As Integer, ByVal nMessageID As Integer, ByVal pszClass As String, ByVal nPriority As Integer, ByVal hDS As Long)
Dim x As Long
Dim hPDU As Long
Dim szAE As String
Dim lParent As Long
Dim NewNode As Node
Dim nRet As Integer
Dim szName As String
Dim szFile As String
Dim szReply As String
'this sample simple returns all the data sets that it is managing.
'in a real-life scenario, this should perform an actual query based
'on the attribute values supplied in hDS
hPDU = LEADDICOMNet1.GetAssociate (hNet)
szAE = LEADDICOMNet1.GetCalling (hPDU)
Set NewNode = TreeView1.Nodes.Add(, , , "Command Set - " & "C-FIND-REQUEST")
NewNode.EnsureVisible
lParent = NewNode.Index
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Presentation ID: " & CStr(nPresentationID))
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Message ID: " & CStr(nMessageID))
nRet = LEADDICOM1.FindUID(pszClass)
If (nRet = 0) Then
szName = LEADDICOM1.CurrentUID.Name
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Affected SOP Class: " & szName & " - " & pszClass)
Else
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Affected SOP Class: " & pszClass)
End If
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Priority: " & CStr(nPriority))
If (File1.ListCount > 1) Then
For x = 0 To File1.ListCount - 1
'load each file and send it to the calling AE
szFile = File1.Path & "\" & File1.List(x)
nRet = LEADDICOM1.LoadDS (szFile, 0)
If (nRet = 0) Then
'now, send a Find Response - PENDING
LEADDICOMNet1.SendCFindResponse hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_PENDING, LEADDICOM1.hDicomDS
End If
Next
End If
'now, send a Find Response - SUCCESS
LEADDICOMNet1.SendCFindResponse hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_SUCCESS, 0
End Sub