VB 怎么讀取列印機的作業狀態,如:正在列印 還是空閑,或者是有排隊任務,能否讀出這些排隊任務???????????
我想達到的目的是,通過判斷列印機忙碌與否,好動態的分配列印任務?
uj5u.com熱心網友回復:
這個有介面的。N年前做過。uj5u.com熱心網友回復:
Declare Function OpenPrinterA Lib "winspool.drv" (ByVal pPrinterName As String, _phPrinter As Long, pDefault As Any) As Long
Declare Function EnumJobsA Lib "winspool.drv" (ByVal hPrinter As Long, _
ByVal FirstJob As Long, ByVal NoJobs As Long, _
ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, _
pcbNeeded As Long, pcReturned As Long) As Long
Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
例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&) = 0 Then Exit Sub
EnumJobsA hPrinter, 0, &HFFFFFFFF, 1, b(0), 1000, dwNeeded, dwReturned
MsgBox "共有" & dwReturned & "份列印作業"
ClosePrinter hPrinter
End Sub
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/91004.html
標籤:API
下一篇:求解惑 很簡單的問題 菜鳥太白
