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
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