怎样判断打印机的状态?

nternter 2002-09-25 10:16:21
请问怎样判断打印机的各种状态
比如:
正在打印
关了电源
联机状态
...全文
111 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjfgj 2002-11-09
  • 打赏
  • 举报
回复
用EnumPrinters函数调用PRINTER_INFO_2结构数据
沧-海-桑-田 2002-11-09
  • 打赏
  • 举报
回复
不行不行,在2000下会报错啊
boynicky 2002-09-25
  • 打赏
  • 举报
回复
关注!
南飞 2002-09-25
  • 打赏
  • 举报
回复
y
hongqi162 2002-09-25
  • 打赏
  • 举报
回复
哦!up !
haoqingqlm 2002-09-25
  • 打赏
  • 举报
回复
状态是英文,没什么问题吧!


function PrinterStatus : integer;
asm
mov ah, 2 // function 2 - returns status of port
mov dx, 0 // lpt1 = 0, lpt2 = 1 etc
int $17 // status in ah
mov al, ah
and eax, $FF // status now in eax with top 24 bits cleared
end;

const
PrinterCodes : array [0..7] of string =
('printer timed-out',
'unused',
'unused',
'I/O error',
'printer selected',
'out of paper', //缺纸
'printer acknowedgment',
'printer not busy');


procedure TForm1.Button1Click(Sender: TObject);
var
L,P : integer;
begin
P := PrinterStatus; //status of printer in P
ListBox1.Clear;
for L := 0 to 7 do
if P and (1 shl L) <> 0 then
ListBox1.Items.Add (PrinterCodes [L]);
end;

5,930

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧