نمایش نتایج 1 تا 2 از 2

نام تاپیک: آیا در دلفی تابعی هست که آماده بودن چاپگر رو تست کنه ؟

  1. #1

    Tick آیا در دلفی تابعی هست که آماده بودن چاپگر رو تست کنه ؟

    سلام به همه
    من میخوام قبل از دادن دستور چاپ از آماده بودن چاپگر مطمئن باشم
    البته در صورت آماده نبودن چاپگر ویندوز یک پیغام میده
    ولی میخوام بوسیله دلفی چاپگر رو تست کنم
    آیا در دلفی تابعی هست که آماده بودن چاپگر رو تست کنه ؟

  2. #2
    سلام


    unit ps1;
    interface
    uses
    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
    StdCtrls, printers;
    type
    TForm1 = class(TForm)
    Button1: TButton;
    ListBox1: TListBox;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    private
    public
    end;
    var
    Form1: TForm1;
    implementation
    {$R *.DFM}
    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');
    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;
    procedure TForm1.Button1Click(Sender: TObject);
    var
    L, P : integer;
    begin
    P := PrinterStatus;
    ListBox1.Clear;
    for L := 0 to 7 do
    if P and (1 shl L) > 0 then
    ListBox1.Items.Add (PrinterCodes [L]);
    end;
    end.

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •