Using the Events OnStatus, OnPrinterReport, and OnPrintJobReport Example for Visual Basic
' [General][Declarations]
Private WithEvents objPrintSCU As LEADDicomPrintSCU
Private Sub objPrintSCU_OnStatus(ByVal Status As LTDICPRNSCULib.PrintScuStatusEnum, _
ByVal OperationStatus As Long)
Select Case Status
Case PRNSCU_STATUS_RECEIVE_ABORT
MsgBox "Source = " & objPrintSCU.AbortSource & ", " & _
"Reason = " & objPrintSCU.AbortReason, , _
"Print SCP Aborted the Association"
Case PRNSCU_STATUS_RECEIVE_PRINT_FILM_SESSION_RSP
Dim sStatusCodeType As String
If OperationStatus = COMMAND_STATUS_SUCCESS Then
If objPrintSCU.LastOperationStatus = COMMAND_STATUS_SUCCESS Then
sStatusCodeType = "Success"
Else
sStatusCodeType = "Warning"
End If
Else
sStatusCodeType = "Failure"
End If
Dim sOpStatus As String
sOpStatus = Hex(objPrintSCU.LastOperationStatus)
Do While Len(sOpStatus) < 4
sOpStatus = "0" & sOpStatus
Loop
sOpStatus = "0x" & sOpStatus
MsgBox "Status: " & sOpStatus & " (" & sStatusCodeType & ")", , _
"Received N-ACTION-RSP (Basic Film Session SOP Class)"
End Select
End Sub
Private Sub objPrintSCU_OnPrinterReport(ByVal EventTypeID As Integer, _
ByVal PrinterStatusInfo As String, _
ByVal FilmDestination As String, _
ByVal PrinterName As String)
Dim sEventTypeName As String
sEventTypeName = "Normal"
Select Case EventTypeID
Case 2
sEventTypeName = "Warning"
Case 3
sEventTypeName = "Failure"
End Select
Dim sMsg As String
sMsg = "Event Type Name: " & sEventTypeName
If EventTypeID <> 1 Then
sMsg = sMsg & vbNewLine & _
"Printer Status Info: " & PrinterStatusInfo & vbNewLine & _
"Film Destination: " & FilmDestination & vbNewLine & _
"Printer Name: " & PrinterName
End If
MsgBox sMsg, , "Printer Status Report"
End Sub
Private Sub objPrintSCU_OnPrintJobReport(ByVal PrintJobSOPInstanceUID As String, _
ByVal EventTypeID As Integer, _
ByVal ExecutionStatusInfo As String, _
ByVal PrintJobID As String, _
ByVal FilmSessionLabel As String, _
ByVal PrinterName As String)
Dim sEventTypeName As String
sEventTypeName = "Pending"
Select Case EventTypeID
Case 2
sEventTypeName = "Printing"
Case 3
sEventTypeName = "Done"
Case 4
sEventTypeName = "Failure"
End Select
MsgBox "Print Job SOP Instance UID: " & PrintJobSOPInstanceUID & vbNewLine & _
"Event Type Name: " & sEventTypeName & vbNewLine & _
"Execution Status Info: " & ExecutionStatusInfo & vbNewLine & _
"Film Session Label: " & FilmSessionLabel & vbNewLine & _
"Printer Name: " & PrinterName, , _
"Print Job Status Report"
End Sub