如何清除指定名称的打印机驱动程序中的待打印任务
怎么清除指定名称的打印机驱动程序中的待打印任务
不用考虑已经发送到打印机缓存中任务
在网上搜索了一上,怎么也找不到,请****中的高人,指点!
------解决方案--------------------
最好是有开发商的sdk
------解决方案--------------------
呃.........我也想知道,以前试过,但是木有办法
暂时只知道拔电源
------解决方案--------------------
delphi中的winSpool提供了足够的信息,可以实现
不用考虑已经发送到打印机缓存中任务
在网上搜索了一上,怎么也找不到,请****中的高人,指点!
------解决方案--------------------
最好是有开发商的sdk
------解决方案--------------------
呃.........我也想知道,以前试过,但是木有办法
暂时只知道拔电源
------解决方案--------------------
delphi中的winSpool提供了足够的信息,可以实现
- Delphi(Pascal) code
Uses Winspool, printers; {-- GetCurrentPrinterHandle -------------------------------------------} {: Retrieves the handle of the current printer @Returns an API printer handle for the current printer @Desc Uses WinSpool.OpenPrinter to get a printer handle. The caller takes ownership of the handle and <b>must</b> call ClosePrinter on it once the handle is no longer needed. Failing to do that creates a serious resource leak! <P> Requires Printers and WinSpool in the Uses clause. @Raises EWin32Error if the OpenPrinter call fails. }{ Created 30.9.2000 by P. Below -----------------------------------} Function GetCurrentPrinterHandle: THandle; Const Defaults: TPrinterDefaults = ( pDatatype : nil; pDevMode : nil; DesiredAccess : PRINTER_ACCESS_USE or PRINTER_ACCESS_ADMINISTER ); Var Device, Driver, Port : array[0..255] of char; hDeviceMode: THandle; Begin { GetCurrentPrinterHandle } Printer.GetPrinter(Device, Driver, Port, hDeviceMode); If not OpenPrinter(@Device, Result, @Defaults) Then RaiseLastWin32Error; End; { GetCurrentPrinterHandle } {: Kill all pending jobs on the current printer } Procedure PurgeJobsOnCurrentPrinter; Var hPrinter: THandle; Begin hPrinter:= GetCurrentPrinterHandle; try If not WinSpool.SetPrinter( hPrinter, 0, nil, PRINTER_CONTROL_PURGE ) Then RaiseLastWin32Error; finally ClosePrinter( hPrinter ); end; End; { PurgeJobsOnCurrentPrinter }
------解决方案--------------------
windows不是对所有打印机的控制都有效。。。
所以不要过于寄于API上,尽量找下相应的SDK才行