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

Setting Printer DPI / Resolution / Quality

670 views
Skip to first unread message

Tony Lorenzo

unread,
Nov 10, 1999, 3:00:00 AM11/10/99
to
Hello,

I am looking to change or ensure that the default printer has been set to a
certain dpi ( 600 ). If not I wish to set it, programatically. I have
looked at the TPrinter but this does not have the functionality to do so.

I have also looked at creating a HDC to a printer, but again, I have not had
luck in doing so. Could anyone help with a snippet on how I may accomplish
this task.

Thanks in advance,

Tony Lorenzo


Peter Below (TeamB)

unread,
Nov 10, 1999, 3:00:00 AM11/10/99
to
In article <80bvjb$e7...@forums.borland.com>, Tony Lorenzo wrote:
> I am looking to change or ensure that the default printer has been set to a
> certain dpi ( 600 ). If not I wish to set it, programatically. I have
> looked at the TPrinter but this does not have the functionality to do so.
>

Well, the printer may not even *support* 600 dpi bit you can try this:

var
Device, Driver, Port: array[0..80] of Char;
DevMode: THandle;
pDevmode: PDeviceMode;
begin
// Get printer device name etc.
Printer.GetPrinter(Device, Driver, Port, DevMode);
// force reload of DEVMODE
Printer.SetPrinter(Device, Driver, Port, 0) ;
// get DEVMODE handle
Printer.GetPrinter(Device, Driver, Port, DevMode);
If Devmode <> 0 Then Begin
// lock it to get pointer to DEVMODE record
pDevMode := GlobalLock( Devmode );
If pDevmode <> Nil Then
try
With pDevmode^ Do Begin
If dmYResolution <> 600 Then Begin
// modify y resolution
dmYResolution := 600;
// tell printer driver that dmYresolution field contains
// data it needs to inspect.
dmFields := dmFields or DM_YRESOLUTION;
End;
End;
finally
// unlock devmode handle.
GlobalUnlock( Devmode );
end;
End; { If }
end;

Depending on the printer you may need to change the dmPrintQuality field as
well, it contains the resolution in X if the value is > 0. Setting
dmPrintQuality to DMRES_HIGH my also switch to the printers best resolution.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!


Tony Lorenzo

unread,
Nov 10, 1999, 3:00:00 AM11/10/99
to
I will try it now.

Thank you for much for the example. I greatly appreciate!!


Peter Below (TeamB) <10011...@compuXXserve.com> wrote in message ...

0 new messages