Dim dwLength As Long Dim osbyStatus(256) As Byte Dim sbyStatus(256) As Byte Dim hPrinter As Long Dim i As Long Dim etbCommand As String Dim printerReset As String Dim nReturned As Long Dim pOnline As Boolean Dim Result As Boolean Dim MyDocInfo As DOCINFO Dim Doc As Long ' The ETB command updates a counter within the printer ' this counter goes from (hex) 00 to 02 to 04, etc, until ' it's maximum value, and then back down again. When the printer ' is reset, the counter resets to 00 etbCommand = Chr(&H17) + Chr(&H0) printerReset = Chr(&H1B) + Chr(&H3F) + Chr(&HA) + Chr(&H0) MyDocInfo.pDocName = "Test" MyDocInfo.pOutputFile = vbNullString MyDocInfo.pDatatype = vbNullString ' This variable will keep track of the printer's ' online/offline status pOnline = False ' First, open the printer using the Windows API If OpenPrinter(Combo1.Text, hPrinter, 0) Then If hPrinter <> INVALID_HANDLE_VALUE Then ' Get the printer's original status (before updating the ETB counter) SMJSMonGetStatusEx hPrinter, osbyStatus(0), 256, dwLength Doc = StartDocPrinter(hPrinter, 1, MyDocInfo) StartPagePrinter hPrinter ' Use the Windows API to write the ETB command to the driver Result = WritePrinter(hPrinter, ByVal etbCommand, Len(etbCommand), nReturned) Result = EndPagePrinter(hPrinter) Result = EndDocPrinter(hPrinter) ' Unfortunately, it takes approximately 2.8 seconds before the ETB counter is ' updated. You may adjust this for optimal performance. If checked too soon, ' the program will always report the printer is offline Wait 2800 ' Check again after the counter updates SMJSMonGetStatusEx hPrinter, sbyStatus(0), 256, dwLength ' Now you can go through each byte and check for any changes ' If there are any at all, including any not related to the ' ETB counter, the printer is online For i = 0 To 256 If sbyStatus(i) <> osbyStatus(i) Then pOnline = True Exit For End If Next i Else dwLength = 0 End If ' Now using the "pOnline" variable, you can tell if the printer ' is on or offline. If dwLength <> 0 Then If pOnline = True Then Text1.Text = "" For i = 0 To dwLength - 1 Text1.Text = Text1.Text + Right("00" + Hex(osbyStatus(i)), 2) + " " Next i Else Text1.Text = "Printer is offline." End If Else Text1.Text = "Could not get status (SMJSMonGetStatusEx)" End If ClosePrinter hPrinter Else Text1.Text = "Could not get status (OpenPrinter)" End If