Results 1 to 2 of 2

Thread: Determine parallel port printer status?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2008
    Posts
    6

    Determine parallel port printer status?

    How can I determine the status of a printer connected to a parallel port (typically LPT1 or LPT2) as to if the printer is actually there, is turned on, is on line, and has paper in it?

    Thanks!

  2. #2
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    Re: Determine parallel port printer status?

    Quote Originally Posted by Magaero
    How can I determine the status of a printer connected to a parallel port (typically LPT1 or LPT2) as to if the printer is actually there, is turned on, is on line, and has paper in it?

    Thanks!
    EDIT: Since I posted this, Hack has answered a similar post with the included link. Take a look...
    http://www.vbforums.com/showthread.p...nter+status%22

    I don't have any LPT ports on this PC so I can't test this code to see if it returns any printers. It does return No Printers for me, but I would expect that. Please let me know if it returns your printers collection.

    vbnet Code:
    1. 'Port Property Example
    2. 'This example examines each Printer object in the Printers collection to find one
    3. 'connected to a specific port and makes it the default printer.
    4. 'Note: Taken from the VB hlp files. This code is modified to return found printers.
    5. 'This code is untested by me due to the absence of LPT ports.
    6.  
    7. Option Explicit
    8.  
    9.  
    10. Private Sub Form_Load()
    11.    Show
    12.    Dim P As Object
    13.    Dim i%
    14.    Dim pPort$
    15.  
    16.    For i = 1 To 5
    17.       For Each P In Printers
    18.           pPort$ = "LPT" & i
    19.     If P.Port = pPort$ Or P.DeviceName Like "*LaserJet*" Then
    20. 'Set Printer = P       ' We don't want to set the printer, just find it.
    21.       'Print P & "Found on " & pPort$
    22.       MsgBox P & "Found on " & pPort$
    23.       Else
    24.       Print "No printer found on " & pPort$
    25.       'MsgBox "No printer found on " & pPort$
    26.       Exit For
    27.     End If
    28.       Next P
    29.    Next i
    30. End Sub
    Last edited by CDRIVE; Jan 31st, 2008 at 08:48 AM. Reason: more info
    <--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
    If topic has been resolved, please pull down the Thread Tools & mark it Resolved.


    Is VB consuming your life, and is that a bad thing??

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