Changing the Output Directory through the API for a Print Job using the Messaging Interface VB.NET Sample code

Private Const PrinterName As String = "Black Ice ColorPlus"

 

' Add reference to these ActiveX controls

Private BiPrnDrv As BIPRNDRVLib.BiPrnDrv

Private BlackIceDEVMODE As BLACKICEDEVMODELib.BlackIceDEVMODE

 

Private Sub StartCapture()

    BiPrnDrv = New BIPRNDRVLib.BiPrnDrv()

    BlackIceDEVMODE = New BLACKICEDEVMODELib.BlackIceDEVMODE()

 

    ' Add event handler

    AddHandler BiPrnDrv.ChangeDevmode, AddressOf BiPrnDrv_ChangeDevmode

 

    BiPrnDrv.StartCapture(PrinterName, 3) ' 3: MESSAGE_CAPTURE_METHOD_PIPE

End Sub

 

Private Sub StopCapture()

    BiPrnDrv.StopCapture()

    ' remove event handler

    RemoveHandler BiPrnDrv.ChangeDevmode, AddressOf BiPrnDrv_ChangeDevmode

End Sub

 

Private Sub BiPrnDrv_ChangeDevmode(pDevMode As Integer) ' Long for the 64 bit OCX

    ' Set file name generation method to exact filename

    BlackIceDEVMODE.SetFileGenerationMethod(3, pDevMode) ' 3: FILENAME_EXACT_DEVMODE

    ' Set the filename (you can give a full path here)

    BlackIceDEVMODE.SetImageFileName("name.pdf", pDevMode)

End Sub

 

Using Message Capture and Printing from the Same Process

 

If you wish to extend the Message Capture samples with printing using AutoPrint, or otherwise combine message capture and printing in the same application, the printing thread must be separated from the message capture thread.

 

When using the BiAutoPrint and BiPrnDrv OCX controls from the same application in .NET languages, the controls must be created and initialized on a separate thread, because .NET will call the controls from the thread they were created on, using an invocation mechanism, even if you access the objects from a separate thread.

 

Printing and capturing messages from the same thread will result in lost ChangeDevmode messages. Other messages may appear to work, but they will be delayed. This is because ChangeDevmode messages will wait for response and eventually time out, while other messages do not wait for response and are queued.