October 23, 2018
Hot Topics:

Develop Your Own Browser - Part 1

  • November 20, 2002
  • 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

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

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

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.


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