NetReceiveCGetRequest Example for Visual Basic
Private Sub LEADDICOMNet1_NetReceiveCGetRequest(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 nRet As Integer
Dim szFile As String
Dim NewNode As Node
Dim szReply As String
Dim lParent As Long
Dim szName As String
Dim szAE As String
Dim hPDU As Long
Dim szInstance As String
Set NewNode = TreeView1.Nodes.Add(, , , "Command Set - " & "C-GET-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))
'perform the get
'here, the AE should check the data set, and perform
'matching against the files stored on the AE to determine
'what data set(s) should be sent back to the calling AE.
'In our case, we just send back a predetermined file for
'this demo!
'load the sample file
'NOTE: this sample is looking for a particular filename TEST2.DIC
szFile = "e:\images\dicom16.dic"
nRet = LEADDICOM1.LoadDS (szFile, 0)
'now, send a store command for the get sub-operation
hPDU = LEADDICOMNet1.GetAssociate (hNet)
szAE = LEADDICOMNet1.GetCalling (hPDU)
nRet = LEADDICOM1.FindFirstElement (TAG_SOP_INSTANCE_UID, False)
If (nRet = 0) Then
nRet = LEADDICOM1.GetStringValue (0, 1)
If (nRet = 0) Then
szInstance = LEADDICOM1.StringValues (0)
End If
End If
nRet = LEADDICOMNet1.SendCStoreRequest (hNet, nPresentationID, nMessageID + 1, pszClass, szInstance, nPriority, szAE, nMessageID, LEADDICOM1.hDicomDS)
'the above will cause a ReceiveCStoreResponse event on this machine
'we will send a get response after we have received the CStoreResponse from the calling AE
End Sub