感谢您使用微软产品。您可以用API来实现:OpenPrinter,EnumJobs ,GetPrinter 等等。下面介绍几篇关于这方面编程的文章(其中也有例子)。HOWTO: Get the Status of a Printer and a Print Job
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q160129Sample: PrintMon.exe Demonstrates the Win32 Spooler API
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q196805HOWTO: Retrieve Print Job Information
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q228769-微软亚洲技术中心 VB开发支持本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款 (http://www.csdn.net/microsoft/terms.shtm)。
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q160129Sample: PrintMon.exe Demonstrates the Win32 Spooler API
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q196805HOWTO: Retrieve Print Job Information
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q228769-微软亚洲技术中心 VB开发支持本贴子仅供CSDN的用户作为参考信息使用。其内容不具备任何法律保障。您需要考虑到并承担使用此信息可能带来的风险。具体事项可参见使用条款 (http://www.csdn.net/microsoft/terms.shtm)。
解决方案 »
- 多表查询空值赋零?
- MSHFlexGrid 如何保持先前的排序?
- 谁能用代码解释一下下面的For Each...In...语句?
- 老问题我可我还是没有解决,请大家帮助!我用ado连接sql server7.0数据库运行储存过程,一般的储存过程返回数据集都没问题,但是只要涉及
- 求助,恳请高手帮忙,不盛感激!
- 如何才能使自定义控件中的按钮文本框根据控件大小改变尺寸
- 制作安装程序中对于SQL Server数据库的处理的问题
- 如何在vb程序里面把某个服务器上的所有的用户数据库提取出来,显示到comboBox里面
- 关于VBA网页登陆,fiddler相关问题
- 为什么在vb调用excel 时,运行时说自动化操作时文件名或类名没找到
- 请串行通讯高手帮忙
- VB低级问题,我都解决不了,神呀~~救救我
具体这样实现
Private Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, pDefault As Any) As Long
Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long
Private Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Any, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim hPrinter As Long, lNeeded As Long, lReturned As Long
Dim lJobCount As Long
OpenPrinter Printer.DeviceName, hPrinter, ByVal 0&
EnumJobs hPrinter, 0, 99, 1, ByVal 0&, 0, lNeeded, lReturned
If lNeeded > 0 Then
ReDim byteJobsBuffer(lNeeded - 1) As Byte
EnumJobs hPrinter, 0, 99, 1, byteJobsBuffer(0), lNeeded, lNeeded, lReturned
If lReturned > 0 Then
lJobCount = lReturned
Else
lJobCount = 0
End If
Else
lJobCount = 0
End If
ClosePrinter hPrinter
MsgBox "Jobs in printer queue: " + CStr(lJobCount), vbInformation
End Sub