×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can you find out if a printer is offline/online - API maybe??

Can you find out if a printer is offline/online - API maybe??

Can you find out if a printer is offline/online - API maybe??

(OP)
Does anyone know of an API call or whatever to find out if a printer is online or offline??

RE: Can you find out if a printer is offline/online - API maybe??

There is an API Function called 'GetPrinter' which will return PRINTER_INFO_x (the x can be 1-5). Each PRINTER_INFO structure is designed to give various levels of information. I'm not sure which contains the 'status' of online/offline but I do know that it is in one of them. Do a search on both GetPrinter and PRINTER_INFO_ to find out exactly how to use them. The declaration for 'GetPrinter' in Visual Basic is:

Declare Function GetPrinter& Lib "spoolss.dll" Alias "GetPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, pPrinter As Byte, ByVal cbBuf As Long, pcbNeeded As Long)

where
hPrinter is a handle to an open printer
Level is the 'x' for the PRINTER_INFO_x
pPrinter is buffer to load with info
cbBuf will be the size of the buffer
pcbNeeded is how many bytes will be needed for the info.

HTH, Spaz

RE: Can you find out if a printer is offline/online - API maybe??

This should work.
{newline}
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long.

{newline}
Type PRINTER_DEFAULTS
{newline}pDatatype As String
{mewline}pDevMode As Long
{newline}DesiredAccess As Long
{newline}
End Type

RE: Can you find out if a printer is offline/online - API maybe??

(OP)
Thats brill folks - thanks a mill! :~)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close