NetReceiveCMoveRequest Example for Visual Basic
Private Sub LEADDICOMNet1_NetReceiveCMoveRequest (ByVal hNet As Long, ByVal nPresentationID As Integer, ByVal nMessageID As Integer, ByVal pszClass As String, ByVal nPriority As Integer, ByVal pszMoveAE As String, ByVal hDS As Long)
Dim nRet As Integer
Dim NewNode As Node
Dim szReply As String
Dim lParent As Long
Dim szName As String
Dim hPDU As Long
Dim szAbstract As String
Dim szTransfer As String
Dim szInstance As String
Dim szClassUID As String
Dim nID As Integer
Set NewNode = TreeView1.Nodes.Add(, , , "Command Set - " & "C-MOVE-REQUEST")
NewNode.EnsureVisible
lParent = NewNode.Index
hPDU = LEADDICOMNet1.GetAssociate (hNet)
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))
Set NewNode = TreeView1.Nodes.Add(lParent, tvwChild, , "Move AE Title: " & pszMoveAE)
'this sample simply returns a fixed dicom data set.
LEADDICOM1.LoadDS "e:\images\dicom16.dic", 0
LEADDICOM1.MoveFirstElement False
LEADDICOM1.FindFirstElement TAG_SOP_INSTANCE_UID, False
LEADDICOM1.GetStringValue 0, 1
szInstance = LEADDICOM1.StringValues (0)
LEADDICOM1.MoveFirstElement False
LEADDICOM1.FindFirstElement TAG_SOP_CLASS_UID, False
LEADDICOM1.GetStringValue 0, 1
szClassUID = LEADDICOM1.StringValues (0)
nID = LEADDICOMNet1.FindPresentationAbstract (hPDU, szClassUID)
If (nID = 0) Then
nRet = LEADDICOM1.FindUID(szClassUID)
If (nRet = 0) Then
MsgBox "Abstract Syntax, " & LEADDICOM1.CurrentUID.Name & ", Not Supported by Association!"
Else
MsgBox "Abstract Syntax, " & szClassUID & ", Not Supported by Association!"
End If
'send a response
LEADDICOMNet1.SendCMoveResponse hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_NO_SUCH_CLASS, 0, 0, 1, 0, 0
Exit Sub
End If
'now, send the C-STORE sub operation
LEADDICOMNet1.SendCStoreRequest hNet, nID, nMessageID + 1, szClassUID, szInstance, nPriority, pszMoveAE, nMessageID, LEADDICOM1.hDicomDS
'send a response
LEADDICOMNet1.SendCMoveResponse hNet, nPresentationID, nMessageID, pszClass, COMMAND_STATUS_SUCCESS, 0, 1, 0, 0, 0
End Sub