欢迎来到代码驿站!

Delphi代码

当前位置:首页 > 软件编程 > Delphi代码

Delphi实现检测并枚举系统安装的打印机的方法

时间:2021-04-04 10:14:22|栏目: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.

上一篇:delphi7连接mysql5的实现方法

栏    目:Delphi代码

下一篇:Delphi7中Listview的常用功能汇总

本文标题:Delphi实现检测并枚举系统安装的打印机的方法

本文地址:http://www.codeinn.net/misctech/94202.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有