dcsimg
October 27, 2020
Hot Topics:

Develop Your Own Browser - Part 1

  • By Soma Sundaram
  • Send Email »
  • More Articles »

Insert these declarations into your form declaration section

Private Declare Function PrinterProperties _        Lib winspool.drv _(ByVal hWnd As Long, ByVal hPrinter As Long) _        As LongPrivate Declare Function OpenPrinter _        Lib winspool.drv _Alias OpenPrinterA (ByVal pPrinterName _        As String, _phPrinter As Long, pDefault As PRINTER_DEFAULTS) _        As LongPrivate Declare Function ClosePrinter _        Lib winspool.drv _(ByVal hPrinter As Long) As LongPrivate Type PRINTER_DEFAULTSpDatatype As Long  StringpDevMode As LongpDesiredAccess As LongEnd TypePrivate Const STANDARD_RIGHTS_REQUIRED = &HF0000Private Const PRINTER_ACCESS_ADMINISTER = &H4Private Const PRINTER_ACCESS_USE = &H8Private Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or _PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)

Then Insert these coding into your Click Event:

On Error Resume NextDim retval As Long, hPrinter As LongDim PD As PRINTER_DEFAULTSPD.pDatatype = 0PD.pDesiredAccess = STANDARD_RIGHTS_REQUIRED Or PRINTER_ACCESS_USEPD.pDevMode = 0retval = OpenPrinter(Printer.DeviceName, hPrinter, PD)If retval = 0 ThenMsgBox Printer Not FoundElseretval = PrinterProperties(Me.hWnd, hPrinter) retval = ClosePrinter(hPrinter)End If





Page 3 of 7



This article was originally published on November 20, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.


Thanks for your registration, follow us on our social networks to keep up-to-date