|
-
Jan 30th, 2008, 01:07 PM
#1
Thread Starter
New Member
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!
-
Jan 31st, 2008, 01:03 AM
#2
Re: Determine parallel port printer status?
 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:
'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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|