How to use the Message Capture ActiveX control in Visual Basic without a form

 

Add the control to the project as a Reference and not as a Component

Declare a variable for the object using "WithEvents" :
Dim WithEvents BlackIcePrinter As BiPrnDrv

Create the object using the CreateObject method:
Set BlackIcePrinter = CreateObject("BIPRNDRV.BiPrnDrvCtrl.1")

Specify the printer name. The control will capture the messages from the specified printer.
BlackIcePrinter.PrinterName = "Black Ice Color"

Call the InitCapture() method of the object to initialize the capturing process. You have to call InitCapture() only once, for example when your application starts.

The BiPrnDrv.OCX can fire five different events depending on the current stage of the printing. You have to capture these events with event handling functions the same as you capture other COM events.

 

The 64 bit Message Capture Control cannot be added to the Visual Studio tool Box.

Declaring the control manually please follow the steps below.

 

The steps are the followings:

-Add reference to the BiPrnDrv.OCX in the Visual Studio project:

                - Select “Project/Properties"

                - Select "References"

                - Click "Add…" button

-Select the COM tab

-Select the “Black Ice Message Capture Control” from the list and click on OK

 

-Add a member variable to the Form:

                    Private BiPrnDrv As BIPRNDRVLib.BiPrnDrv

 

-Instantiate the object in the Form’s constructor:

                    BiPrnDrv = New BIPRNDRVLib.BiPrnDrv()

 

-Add the event handler in the Form’s constructor:

                    BiPrnDrv.EndDoc += New BIPRNDRVLib._DBiPrnDrvEvents_EndDocEventHandler(BiPrnDrv_EndDoc)

 

(after typing “BiPrnDrv.EndDoc += ” Visual Studio will offer to create the event handling method)