全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1464
推到 Plurk!
推到 Facebook!

如何取消印表機佇列中的某一個 job ????

答題得分者是:hagar
wenjung
一般會員


發表:21
回覆:61
積分:21
註冊:2002-04-29

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-09-18 16:43:17 IP:210.71.xxx.xxx 未訂閱
請問是否有API 類似 unix 上的 lpstats 可以刪除佇列中某一個 job 嗎 ??
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-09-18 19:48:40 IP:211.22.xxx.xxx 未訂閱
小弟找到一篇是刪除所有 print jobs 的, 參考看看。 不過作者也說 Not Tested! 至於刪除某個 print job 的話, 再找找看吧! Date: Sat, 22 Sep 2001 11:54:41 0200 Newsgroups: borland.public.delphi.winapi Subject: Re: Stop printing job. From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com> Reply-To: 100113.1101@compuXXserve.com In article <3babfab6_1@dnews>, Samson Fu wrote: > We can stop and delete current printing job from "Printer manager". > Can I do it in my code? I want to STOP all "print jobs" and Delete > them in my program. Try the PurgeJobsOnCurrentPrinter procedure given below. Not tested! 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 must call ClosePrinter on it once the handle is no longer needed. Failing to do that creates a serious resource leak! 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 }
Peter Below (TeamB) 100113.1101@compuserve.com)
-- Everything I say is a lie.
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-09-18 20:02:32 IP:211.22.xxx.xxx 未訂閱
這裏 http://www.code4sale.com/tryitbuyit/ 有個元件 叫做 Optional AbortDialog, 也可以試試 描述如下: Optional AbortDialog shows status updates of the print job and allows the user to cancel at any time! ... -- Everything I say is a lie.
系統時間:2017-11-18 19:52:15
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!