Results 1 to 3 of 3

Thread: how can i detect whether a printer is installed in code

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Brisbane, Qld, Australia
    Posts
    78

    Question

    Hi,
    I am wondering if anyone out there knows how to detect whether a printer is installed under windows or not? Is it possible? how is it done in code? Any help is appreciated and thanx in advance.

    Mike

  2. #2
    Lively Member
    Join Date
    Sep 2000
    Posts
    68
    Try the code below, it works on my machine.

    Im not sure if this is the best way to do it but hey, it works!!!!

    Dim ConnectedPrinter As Printer
    Dim NumOfPrinters As Integer

    For Each ConnectedPrinter In Printers
    NumOfPrinters = NumOfPrinters + 1
    Next ConnectedPrinter


    If NumOfPrinters = 0 Then
    ' NO PRINTER INSTALLED!
    End If

    THE DOUGSTER!!!!!!


    *-MCSD-*

  3. #3
    Guest
    Use the printers collection:

    Code:
    Private Function checkPrinters(strFindMe as string) 
      Dim p as printer
      For each p in printers
        If p.devicename = strFindMe then
          checkPrinters = True
          exit function
        End if
      Next p
      checkPrinters = False
    End function
    Alternatively, you could use the p.drivername property to see if any compatible printer is installed. Or, instead of returning true, you could Set Printer = p to make the one you found the current printer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width