function to check is printer is ready

Basically i want to create a function that i send a printer name and if it is anything other than ready return false

    Function CheckPrinter(printer As String) As Boolean



    End Function

I have looked at the code for  printer status and such but nothing really is simple
MillkindAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jkribaHTSCommented:
Have you looked into this, basically you are trying to enumerate the status of the printer driver...its win32..

https://support.microsoft.com/en-us/kb/202480

Thanks
Regards
JK
0
CodeCruiserCommented:
There is a relatively simple way using .NET

https://msdn.microsoft.com/en-us/library/aa970845(v=vs.110).aspx

Dim printQueues As PrintQueueCollection = Nothing
Dim printerDescriptions As List(Of PrinterDescription) = Nothing

' Get a list of available printers.
Me.printServer = New PrintServer()
printQueues = Me.printServer.GetPrintQueues(New () {EnumeratedPrintQueueTypes.Local, EnumeratedPrintQueueTypes.Connections})
printerDescriptions = New List(Of PrinterDescription)()

For Each printQueue As PrintQueue In printQueues
	' The OneNote printer driver causes crashes in 64bit OSes so for now just don't include it.
	' Also redirected printer drivers cause crashes for some printers. Another WPF issue that cannot be worked around.
	If printQueue.Name.ToUpperInvariant().Contains("ONENOTE") OrElse printQueue.Name.ToUpperInvariant().Contains("REDIRECTED") Then
		Continue For
	End If

	Dim status As String = printQueue.QueueStatus.ToString()

	Try
		Dim printerDescription As New PrinterDescription() With { _
			Key .Name = printQueue.Name, _
			Key .FullName = printQueue.FullName, _
			Key .Status = If(status = Strings.Printing_PrinterStatus_NoneTxt, Strings.Printing_PrinterStatus_ReadyTxt, status), _
			Key .ClientPrintSchemaVersion = printQueue.ClientPrintSchemaVersion, _
			Key .DefaultPrintTicket = printQueue.DefaultPrintTicket, _
			Key .PrintCapabilities = printQueue.GetPrintCapabilities(), _
			Key .PrintQueue = printQueue _
		}

		printerDescriptions.Add(printerDescription)
			' ... Logging removed
	Catch ex As PrintQueueException
	End Try
Next

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MillkindAuthor Commented:
That is what i found as well.  I just wanted a simple function.  Thanks anyway.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.