RemovePrinter (IEpnPrinterList) Example for Visual Basic

Private Sub RemovePrinter_Click()
   Dim BatchPrinterInfo As New EpnBatchPrinterInfo
   Dim PrintersList As New EpnPrinterList
   Dim ePrint As New ePrint
   
   Dim PrinterIndex As Integer
   
   If ePrint.IsSupportLocked (SUPPORT_OEM) Then
      ePrint.UnlockSupport SUPPORT_OEM, OEM_KEY
   End If
   
   BatchPrinterInfo.PrinterName = Printer.DeviceName
   ePrint.GetDefaultEnhancedOptions BatchPrinterInfo.EnhancedOptions
   BatchPrinterInfo.Flags = VALID_ENHANCED_OPTIONS
   PrinterIndex = PrintersList.GetPrinterIndex (BatchPrinterInfo) 
   
   PrintersList.RemovePrinter PrinterIndex
End Sub