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!
Printable View
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...Quote:
Originally Posted by Magaero
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:
'Port Property Example 'This example examines each Printer object in the Printers collection to find one 'connected to a specific port and makes it the default printer. 'Note: Taken from the VB hlp files. This code is modified to return found printers. 'This code is untested by me due to the absence of LPT ports. Option Explicit Private Sub Form_Load() Show Dim P As Object Dim i% Dim pPort$ For i = 1 To 5 For Each P In Printers pPort$ = "LPT" & i If P.Port = pPort$ Or P.DeviceName Like "*LaserJet*" Then 'Set Printer = P ' We don't want to set the printer, just find it. 'Print P & "Found on " & pPort$ MsgBox P & "Found on " & pPort$ Else Print "No printer found on " & pPort$ 'MsgBox "No printer found on " & pPort$ Exit For End If Next P Next i End Sub