uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Inifiles,Printers, ExtCtrls, QuickRpt;
procedure TForm1.Button3Click(Sender: TObject);
var
Device: Array[0..(cchDeviceName -1)] of char;
Driver: Array[0..(MAX_PATH -1)] of char;
Port: Array[0..32] of char;
HDMode : THandle;
PDMode: PDevMode;
printer :Tprinter;
begin
showmessage('111111');
Printer.PrinterIndex := Printer.PrinterIndex ;
showmessage('2222');
Printer.GetPrinter(Device,Driver,Port,HDMode);
showmessage('2222');
showmessage(inttostr(hdmode)) ;
if HDMode <> 0 then
begin
PDMode := GlobalLock(HDMode);
// showmessage(inttostr(PDMode)) ;
if PDMode <> nil then
begin
case pDMode.dmPaperSize of
DMPAPER_USER: showmessage('纸张类型:自定义');
DMPAPER_A3: showmessage('纸张类型:A3');
DMPAPER_A4: showmessage('纸张类型:A4');
DMPAPER_A5: showmessage('纸张类型:A5');
DMPAPER_B4: showmessage('纸张类型:B4');
DMPAPER_B5: showmessage('纸张类型:B5');
else
showmessage('纸张类型:其它');
end;
GlobalUnLock(HDMode);
Printer.PrinterIndex := Printer.PrinterIndex;
end;
end;
end;
我用了不了啊,到
这句老出错
Printer.PrinterIndex := Printer.PrinterIndex ;