Delphi完成檢測並列舉體系裝置的打印機的辦法。本站提示廣大學習愛好者:(Delphi完成檢測並列舉體系裝置的打印機的辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是Delphi完成檢測並列舉體系裝置的打印機的辦法正文
本文以實例解釋Delphi打印法式的完成辦法。該實例可以檢測體系中裝置的一切打印機,列舉出這些打印機,重要功效代碼異常簡略,便於年夜家浏覽與懂得。
重要功效代碼以下:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,Printers, XPMan; type TForm1 = class(TForm) Button1: TButton; GroupBox1: TGroupBox; Memo1: TMemo; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Clear; memo1.Lines.Assign(Printer.Printers); if trim(memo1.Text) = '' then begin showmessage('沒有裝置打印機!'); end; end; procedure TForm1.Button2Click(Sender: TObject); begin Close; end; end.