Ich bin gerade dabei ein kleines Programm zu schreiben, welches bei einem bestimmten Signal am com-Port ein Etikett druckt. Die Softeware die zum Einsatz kommt ist Codesoft 9.
Dort kann auf bestimmte Events reagiert werden.
Z.B. document.PausedPrinting
In der Hilfe steht:
document.PausedPrinting (Reason, refCancel)
"Informs the user of a problem during printing process for the current document."
Reason = Integer
NoPaper = 2
NoRibbon = 3
...
Parameters:
refCancel = Integer
User must assign this parameter to 1 to abort process.
Nun meine Frage: Wie muss ich den RefVal refcancel definieren?
Mein Code sieht so aus:
Private WithEvents CodesoftApplication As LabelManager2.Application = Nothing
Private WithEvents MyActiveDocument As LabelManager2.Document = Nothing
Private Sub LblDruck_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LblDruck.Click
CodesoftApplication.EnableEvents = True
'Dokument geladen?
If (noDocOpened) Then
MessageBox.Show("Ein Etikett muss geladen sein!")
Exit Sub
End If
'Variable im Label füllen:
'CodesoftApplication.Documents.Application.ActiveDocument.Variables.Item(1).Name = "Zaehler0"
'CodesoftApplication.Documents.Application.ActiveDocument.Variables.Item(1).Value = count
Catch aError As System.FormatException
MessageBox.Show("Label Anzahl muss eine TZahl sein. \n\n\n" + aError.Message)
End Try
End Sub
Private Sub ActiveDocument_PausedPrinting(ByVal Reason As LabelManager2.enumPausedReasonPrinting, ByRef refCancel As Integer)
Dim Message As String = "Fehler beim Druck: " + MyActiveDocument.Name
Select Case Reason
Case LabelManager2.enumPausedReasonPrinting.lppxCommunicationError
Message += " Kommunikationsfehler."
Case LabelManager2.enumPausedReasonPrinting.lppxGenericError
Message += " Allgemeiner Fehler."
Case LabelManager2.enumPausedReasonPrinting.lppxHeadLifted
Message += " Drucker auf."
Case LabelManager2.enumPausedReasonPrinting.lppxNoPaper
Message += " Kein Papier."
Case LabelManager2.enumPausedReasonPrinting.lppxPortNotAvailable
Message += " Druckerport nicht verfügbar."
Case LabelManager2.enumPausedReasonPrinting.lppxPrinterNotReady
Message += " Drucker nicht bereit."
Case LabelManager2.enumPausedReasonPrinting.lppxNoRibbon
Message += " Kein Farbband."
End Select
Try
Call MsgBox(Message)
System.Windows.Forms.Application.DoEvents()
If cancel Then refCancel = True