Printing Tip: How to Create a Silent MSI Printer Driver Install for Vista

Page 2

January Developer News

(Continued from page 1)



Dim hDib As Integer ' DIB handle

Dim fileName As String ' Input file name


Dim TiffObj As Object ' Tiff ocx object

Dim AnnoObj As Object ' Anno ocx object

Dim PrintObj As Object ' Print ocx object


' Set input file name

fileName = "test.tif"


' Create dynamic ocx objects

TiffObj = CreateObject("BITIFF.BITiffCtrl.1")

AnnoObj = CreateObject("BIANNO.BIAnnoCtrl.1")


' Load tiff file

hDib = TiffObj.LoadTiffIntoDIB(fileName, 0, False)


' Create annotations



' Burn the annotations into the DIB

hDib = BiAnno.AnnoBurnin(hDib)


' Print the prepared DIB

If System.Drawing.Printing.PrinterSettings.InstalledPrinters.Count > 0 Then

If hDib <> 0 Then

PrintObj = CreateObject("BIPRINT.BIPrintCtrl.1")

PrintObj.PrepareToPrintEx(pDev, PrinterName, hwnd, view.GetDocument().szFileName, maxPage, 1, True, False, False, False, False, False, False, True, False)

PrintObj.PrintDIBPage(hDib, srect(0), 1, 0, 0)


PrintObj = Nothing

End If


MessageBox.Show("Before you can print, you need to install a printer." + vbCrLf + "To do this, click Start, point to Settings, click Printers, and then double-click Add Printer.", "Annotation Sample")

End If