Home > Software engineering >  VB how to read the working state of the printer, such as: is printed or free
VB how to read the working state of the printer, such as: is printed or free

Time:09-28

VB how to read the working state of the printer, such as: is printed or idle, or there is a queue tasks, can read these queued task?????????????????


I want to reach, is the purpose of through the printer is busy or not, good dynamic distribution of print tasks?

CodePudding user response:

Did this interface, N years ago,

CodePudding user response:

Declare the Function OpenPrinterA Lib "winspool. DRV" (ByVal pPrinterName As String, _
PDefault phPrinter As Long, As Long As Any)
Declare the Function EnumJobsA Lib "winspool. DRV" (ByVal hPrinter As Long, _
ByVal FirstJob As Long, ByVal NoJobs As Long, _
, pJob ByVal Level As Long As Byte, ByVal cdBuf As Long, _
PcReturned pcbNeeded As Long, As Long) As Long
Declare the Function ClosePrinter Lib "winspool. DRV" (ByVal hPrinter As Long) As Long

Case 1:
Sub Test1 ()
Dim hPrinter As Long
Dim dwNeeded As Long
Dim dwReturned As Long
Dim b (1000) As Byte
If OpenPrinterA (pc1 "$", hPrinter, ByVal 0 & amp;)=0 Then the Exit Sub
EnumJobsA hPrinter, 0, & amp; HFFFFFFFF, 1, b (0), 1000, dwNeeded, dwReturned
MsgBox "Shared" & amp; DwReturned & amp; "Print job
"ClosePrinter hPrinter
End Sub
  •  Tags:  
  • API
  • Related