I am trying to gain control of an Axiohm Slip printer device A756. I need
to read the Printer status programatically to determine if the paper has
been inserted -sensors are covered, before I continue to send the print job.
I am using Visual Basic 6 on Windows NT. Writing the Printer codes using
WritePrinter API works fine, however the ReadPrinter API returns an error
-6, invalid Printer Handle, however the Handle is the same as used for the
WritePrinter command. Here is the code:

lReturn = OpenPrinter(sPrinterName, lhPrinter, 0)
If lReturn = 0 Then Exit sub
MyDocInfo.pDocName = "TestDoc"
MyDocInfo.pOutputFile = vbNullString
MyDocInfo.pDatatype = vbNullString
lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
Call StartPagePrinter(lhPrinter)
sData = Chr$(27) & Chr$(102) & Chr$(2) & Chr$(5) '(1)
-initialise slip printer
lReturn = WritePrinter(lhPrinter, ByVal sData, Len(sData), lpcWritten)

sData = Chr$(27) & Chr$(99) & Chr$(48) & Chr$(4) '(2) - select slip
station
lReturn = WritePrinter(lhPrinter, ByVal sData, Len(sData), lpcWritten)
sData = Chr$(27) & Chr$(118) '(3) -transmit printer status
lReturn = WritePrinter(lhPrinter, ByVal sData, Len(sData), lpcWritten)
lReturn = EndPagePrinter(lhPrinter)
lReturn = EndDocPrinter(lhPrinter)
'========================
'Everything above works correctly!
'Now I need to obtain the printer response - which will contain the status
information
'========================
Dim rc As Long
Dim pReadBuffer As String * 8
Dim lNoRead As Long
Dim lError As Long
Dim Counter As Long
Counter = 0
' lReturn = OpenPrinter(sPrinterName, lhPrinter, 0)
Do While Counter < 200
Counter = Counter + 1

rc = ReadPrinter(lhPrinter, pReadBuffer, 8, lNoRead) 'The result
is an error, rc = 0
' Debug.Print lNoRead, pReadBuffer
If rc = 0 Then
lError = GetLastError() 'Error 6 is given -Invalid printer
handle -it is the same as the WritePrinter
MsgBox "Error: " & lError
MsgBox "pReadBuffer: " & pReadBuffer
End If
Loop
lReturn = ClosePrinter(lhPrinter)

Any help would be much appriciated.