N
niuxuefeng
Unregistered / Unconfirmed
GUEST, unregistred user!
我需要自定义纸张大小,写了自定义长度:
procedure SetPaperHeight(Value:integer);
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
if Value < 30 then
Value := 30;
if Value > 432 then
Value := 432;
Printer.PrinterIndex := printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperLength := Value * 10;
pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
可是在Printer.PrinterIndex := printer.PrinterIndex;
这一行运行是出错,提示printers类溢出,再接着运行:Printer.GetPrinter(Device, Driver, Port, hDMode);这一行时,提示:printing in progress!
怎么回事啊,我很急的,望大家帮忙啊!
procedure SetPaperHeight(Value:integer);
var
Device : array[0..255] of char;
Driver : array[0..255] of char;
Port : array[0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
if Value < 30 then
Value := 30;
if Value > 432 then
Value := 432;
Printer.PrinterIndex := printer.PrinterIndex;
Printer.GetPrinter(Device, Driver, Port, hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmFields := pDMode^.dmFields or DM_PAPERSIZE or
DM_PAPERLENGTH;
pDMode^.dmPaperSize := DMPAPER_USER;
pDMode^.dmPaperLength := Value * 10;
pDMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
可是在Printer.PrinterIndex := printer.PrinterIndex;
这一行运行是出错,提示printers类溢出,再接着运行:Printer.GetPrinter(Device, Driver, Port, hDMode);这一行时,提示:printing in progress!
怎么回事啊,我很急的,望大家帮忙啊!