請問如何知道印表機的pDriverName, pPrintProcessor |
尚未結案
|
spencerkuo
一般會員 發表:21 回覆:34 積分:11 註冊:2003-08-15 發送簡訊給我 |
|
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
|
spencerkuo
一般會員 發表:21 回覆:34 積分:11 註冊:2003-08-15 發送簡訊給我 |
引言: 開啟新增印表機精靈這是簡易的新增印表機方式, 但是如果我想要新增完後 把新印表機的名稱回填到我的資料庫 那麼我該如何抓取新印表機的名稱呢??uses shellapi; .... procedure TForm1.Button1Click(Sender: TObject); begin ShellExecute(Handle, PChar('open'), PChar('rundll32.exe'), PChar('shell32.dll, ' 'SHHelpShortcuts_RunDLL ' 'AddPrinter'),nil, SW_NORMAL); end;網海無涯,學無止境! |
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
|
spencerkuo
一般會員 發表:21 回覆:34 積分:11 註冊:2003-08-15 發送簡訊給我 |
引言:謝謝 但是很可惜的 我不是要抓印表機的名稱 我是要知道某品牌電腦的 pDriverName, pPrintProcessor 因為我是想用程式碼來新增印表機 但是苦無不知道如何得知, 我要新增的印表機的pDriverName, pPrintProcessor 所以才這麼的頭痛引言: 如何抓取新印表機的名稱呢??//取得已安裝的印表機名稱列表 uses Printers; ... ComboBox1.items:= printer.printers; 依據需求自行做處理~ < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境! |
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
|
spencerkuo
一般會員 發表:21 回覆:34 積分:11 註冊:2003-08-15 發送簡訊給我 |
引言: 某品牌電腦的 pDriverName, pPrintProcessor ??????? 不好意思,資料不全,無法回答! < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境!我把code放上來, 應該會有更多資訊的 unit unit_AddPrinter; interface function AddAPrinter(PrinterName, PortName, DriverName, PrintProcessor: string): boolean; implementation uses SysUtils, WinSpool, Windows; function AddAPrinter(PrinterName, PortName, DriverName, PrintProcessor: string): boolean; var pName: PChar; Level: DWORD; pPrinter: PPrinterInfo2; begin pName := nil; Level := 2; New(pPrinter); pPrinter^.pServerName := nil; pPrinter^.pShareName := nil; pPrinter^.pComment := nil; pPrinter^.pLocation := nil; pPrinter^.pDevMode := nil; pPrinter^.pSepFile := nil; pPrinter^.pDatatype := nil; pPrinter^.pParameters := nil; pPrinter^.pSecurityDescriptor := nil; pPrinter^.Attributes := 0; pPrinter^.Priority := 0; pPrinter^.DefaultPriority := 0; pPrinter^.StartTime := 0; pPrinter^.UntilTime := 0; pPrinter^.Status := 0; pPrinter^.cJobs := 0; pPrinter^.AveragePPM :=0; pPrinter^.pPrinterName := PCHAR(PrinterName); pPrinter^.pPortName := PCHAR(PortName); pPrinter^.pDriverName := PCHAR(DriverName); pPrinter^.pPrintProcessor := PCHAR(PrintProcessor); if AddPrinter(pName, Level, pPrinter) <> 0 then Result := true else begin // ShowMessage(inttostr(GetlastError)); Result := false; end; end; end. |
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
http://www.sources.ru/delphi/system/addprinter.shtml In order to by program add printer, it is necessary
to use API function AddPrinter, which
has three parameters: 1) the name of the printer
2) press level
3) the description of the printer The following example is superstructure for this function.
For this it is necessary to know the name of printer,
which will be mapped into conductor, the name of the port,
to which is connected the printer (i.e. LPT1:), the name of the driver
(it priydetsya to look by hand) and the name of the processor
of press (which usually "winprint").
unit unit_AddPrinter; interface function AddAPrinter(PrinterName, PortName, DriverName, PrintProcessor: string): boolean; implementation uses SysUtils, WinSpool, Windows; function AddAPrinter(PrinterName, PortName, DriverName, PrintProcessor: string): boolean; var pName: PChar; Level: DWORD; pPrinter: PPrinterInfo2; begin pName := nil; Level := 2; New(pPrinter); pPrinter^.pServerName := nil; pPrinter^.pShareName := nil; pPrinter^.pComment := nil; pPrinter^.pLocation := nil; pPrinter^.pDevMode := nil; pPrinter^.pSepFile := nil; pPrinter^.pDatatype := nil; pPrinter^.pParameters := nil; pPrinter^.pSecurityDescriptor := nil; pPrinter^.Attributes := 0; pPrinter^.Priority := 0; pPrinter^.DefaultPriority := 0; pPrinter^.StartTime := 0; pPrinter^.UntilTime := 0; pPrinter^.Status := 0; pPrinter^.cJobs := 0; pPrinter^.AveragePPM :=0; pPrinter^.pPrinterName := PCHAR(PrinterName); pPrinter^.pPortName := PCHAR(PortName); pPrinter^.pDriverName := PCHAR(DriverName); pPrinter^.pPrintProcessor := PCHAR(PrintProcessor); if AddPrinter(pName, Level, pPrinter) <> 0 then Result := true else begin // ShowMessage(inttostr(GetlastError)); Result := false; end; end; end.網海無涯,學無止境! 發表人 - qoo1234 於 2004/03/04 18:36:06 |
qoo1234
版主 發表:256 回覆:1167 積分:659 註冊:2003-02-24 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |