全部代码
procedure TdlgPrint.bPropertyClick(Sender: TObject);
var
FHandle:THandle;
HPrt:THandle;
FDevice:array[0..255] of char;
FDriver:array[0..255] of char;
FPort:array[0..255] of char;
DeviceMode: THandle;
DevMode: PDeviceMode;
begin
FHandle:=0;
HPrt:=0;
Printer.GetPrinter(FDevice, FDriver, FPort, FHandle);
OpenPrinter(FDevice, HPrt, nil);
DeviceMode := GlobalAlloc(GHND,
do
cumentProperties(0, HPrt, FDevice, DevMode^,
DevMode^, 0));
if DeviceMode <> 0 then
begin
DevMode := GlobalLock(DeviceMode);
ifdo
cumentProperties(0, HPrt, FDevice, DevMode^,
DevMode^, DM_PROMPT) < 0 then
begin
GlobalUnlock(DeviceMode);
GlobalFree(DeviceMode);
DeviceMode := 0;
end;
end;
ClosePrinter(hPrt);
end;