可
可儿
Unregistered / Unconfirmed
GUEST, unregistred user!
我写了一段程序,用于修改win98下面的自定义打印纸张的大小,并将它设置为默认值,
可是结果并没有修改。
procedure TForm1.Button1Click(Sender: TObject);
var
adevice,adriver,aport:array[0..255] of char;
devicehandle:thandle;
devmodedevicemode;
begin
printer.getprinter(adevice,adriver,aport,devicehandle);
if devicehandle=0 then
begin
printer.printerindex:=printer.printerindex;
printer.getprinter(adevice,adriver,aport,devicehandle);
end;
if devicehandle=0 then
raise exception.create('打印机错误!')
else
begin
devmode:=globallock(devicehandle);
with devmode^do
begin
dmfields:=dmfields or dm_orientation;
dmorientation:=dmorient_portrait;
dmfields:=dmfields or dm_papersize;
dmpapersize:=256;
dmfields:=dmfields or dm_paperlength;
dmpaperlength:=2794;
dmfields:=dmfields or dm_paperwidth;
dmpaperwidth:=3500;
end;
ResetDC(Printer.Handle,devmode^);
globallock(devicehandle);
end;
end;
可是结果并没有修改。
procedure TForm1.Button1Click(Sender: TObject);
var
adevice,adriver,aport:array[0..255] of char;
devicehandle:thandle;
devmodedevicemode;
begin
printer.getprinter(adevice,adriver,aport,devicehandle);
if devicehandle=0 then
begin
printer.printerindex:=printer.printerindex;
printer.getprinter(adevice,adriver,aport,devicehandle);
end;
if devicehandle=0 then
raise exception.create('打印机错误!')
else
begin
devmode:=globallock(devicehandle);
with devmode^do
begin
dmfields:=dmfields or dm_orientation;
dmorientation:=dmorient_portrait;
dmfields:=dmfields or dm_papersize;
dmpapersize:=256;
dmfields:=dmfields or dm_paperlength;
dmpaperlength:=2794;
dmfields:=dmfields or dm_paperwidth;
dmpaperwidth:=3500;
end;
ResetDC(Printer.Handle,devmode^);
globallock(devicehandle);
end;
end;