SendCMoveRequest Example for Visual Basic
Dim nRet As Integer
Dim szClassUID As String
Dim nVR As Integer
Dim hPDU As Long
Dim nID As Integer
'send a Move Request to the server
'gszGetFile is a global variable that will be used when we get
'the C-STORE-RQ event to store the file
gszGetFile = InputBox("Select filename for retrieved data set", "Move Request", "d:\temp\move_request.dic")
If (Len(gszGetFile) < 1) Then Exit Sub
szClassUID = InputBox("What class do you wish to move?", "Move Request", UID_NM_IMAGE_STORAGE)
If (Len(szClassUID) < 1) Then Exit Sub
'create the data set that encodes the identifier to be matched
LEADDICOM1.InitDS DICOM_CLASS_UNKNOWN, 0
'add the required elements
LEADDICOM1.FindTag TAG_QUERY_RETRIEVE_LEVEL
nVR = LEADDICOM1.CurrentTag.VR
LEADDICOM1.InsertElement False, TAG_QUERY_RETRIEVE_LEVEL, nVR, False, 0
LEADDICOM1.StringValueCount = 1
LEADDICOM1.StringValues (0) = "PATIENT"
LEADDICOM1.SetStringValue 1
LEADDICOM1.FindTag TAG_PATIENT_NAME
LEADDICOM1.InsertElement False, TAG_PATIENT_NAME, LEADDICOM1.CurrentTag.VR, False, 0
'add the optional fields that we want returned
LEADDICOM1.FindTag TAG_PATIENT_ID
LEADDICOM1.InsertElement False, TAG_PATIENT_ID, LEADDICOM1.CurrentTag.VR, False, 0
LEADDICOM1.FindTag TAG_PATIENT_BIRTH_DATE
nVR = LEADDICOM1.CurrentTag.VR
LEADDICOM1.InsertElement False, TAG_PATIENT_BIRTH_DATE, nVR, False, 0
LEADDICOM1.FindTag TAG_PATIENT_SEX
nVR = LEADDICOM1.CurrentTag.VR
LEADDICOM1.InsertElement False, TAG_PATIENT_SEX, nVR, False, 0
LEADDICOM1.FindTag TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES
nVR = LEADDICOM1.CurrentTag.VR
LEADDICOM1.InsertElement False, TAG_NUMBER_OF_PATIENT_RELATED_INSTANCES, nVR, False, 0
hPDU = LEADDICOMNet1.GetAssociate (LEADDICOMNet1.hNet)
'now, send a request
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
Exit Sub
End If
'we are asking the Called AE to move the SOP Instance to ourselves
LEADDICOMNet1.SendCMoveRequest LEADDICOMNet1.hNet, nID, 1, szClassUID, COMMAND_PRIORITY_MEDIUM, "MI_TEST", LEADDICOM1.hDicomDS
'we now must wait for the response and for the C-STORE sub-operations