procedure TfmLabPrnDlg.SetNumberOfCopies(iCopies: Integer);
var
szDevice, szDriver, szPort: array[0..255] of char;
hDMode : THandle;
pDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.GetPrinter(szDevice, szDriver, szPort, hDMode);
if hDMode <> 0 then begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then begin
pDMode^.dmFields := pDMode^.dmFields or DM_COPIES;
pDMode^.dmCopies := iCopies;
GlobalUnlock(hDMode);
end;
GlobalFree(hDMode);
end;
Printer.PrinterIndex := Printer.PrinterIndex;
end;
Rick
Chris Jones wrote in message <7g7046$lg...@forums.borland.com>...
.... same to here.....
pDMode^.dmCopies := iCopies;
// GlobalUnlock(hDMode); move this after the next 'end'
end;
GlobalUnlock(hDMode); // moved here from above
// GlobalFree(hDMode); remove this
end;
// Printer.PrinterIndex := Printer.PrinterIndex; remove this
end;
That puts it into a format that I know works for me. Of course you can
always use Printer.Copies, but getting the above routine working sets one up
to having much more control over the printer settings (input trays, paper
sizes, etc.).
Good luck,
-Jeff Hamblin
http://www.qtools.com
Chris Jones <Ch...@lycosltd.demon.co.uk> wrote in message
news:7g7046$lg...@forums.borland.com...