|
-
Sep 6th, 2000, 06:29 AM
#1
Thread Starter
Lively Member
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
-
Sep 6th, 2000, 06:42 AM
#2
Lively Member
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-*
-
Sep 6th, 2000, 09:18 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|