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:<br>
<br>
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)<br>
<br>
where<br>
hPrinter is a handle to an open printer<br>
Level is the 'x' for the PRINTER_INFO_x<br>
pPrinter is buffer to load with info<br>
cbBuf will be the size of the buffer<br>
pcbNeeded is how many bytes will be needed for the info.<br>
<br>
HTH, Spaz
This should work.<br>
{newline}<br>
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As PRINTER_DEFAULTS) As Long.<br>
<br>
{newline}<br>
Type PRINTER_DEFAULTS<br>
{newline}pDatatype As String<br>
{mewline}pDevMode As Long<br>
{newline}DesiredAccess As Long<br>
{newline}<br>
End Type<br>
<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.