Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

D4 - setting number of copies on printer

0 views
Skip to first unread message

Chris Jones

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to
Using following bit of code to set number of copies on printer.
Doesn't seem to have any effect.
Many thanks for any suggestions.

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 Roen

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to
Try setting the Printer.Copies to the number of copies you need.

Rick


Chris Jones wrote in message <7g7046$lg...@forums.borland.com>...

Jeff H

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to
Try the following change at the end:

.... 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...

Jeff H

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to
0 new messages