This method updates the contents referred to by the handle of the DEVMODE structure.
Parameters
None
Return Value
Returns True when successful, returns False when not successful.
Explanation
The SetDevModeInfo method updates the contents referred to by the handle of the DEVMODE structure. To execute this method, it is first necessary to execute the GetDevModeHandle and retrieve the handle to the DEVMODE structure in the DevMode property. The Collate, ColorMode, Copies, CustomPaperHeight, CustomPaperWidth, Duplex, Orientation, PaperBin, PaperSize, XResolution, YResolution, and Zoom property settings are all reflected in the DevMode property. If each of these properties are set to 0 then the update will have no affect. (Except for the Collate property). Note: These property settings are dependent upon the printer driver. Because of this, it is possible that some of the property settings will have no affect or an affect different than expected. For details about the printer driver and these properties, please refer to the printer manufacturer's manual.
Sample Codes:
In C++Builder
bool Ret;
VImageKit1->PrintDraw->PrinterName = "EPSON LP-8200C";
VImageKit1->PrintDraw->PrintFileName = "";
Ret = VImageKit1->PrintDraw->GetDevModeHandle();
if (Ret == false) return;
//GetDevModeHandle method calls GetDevModeInfo so the next line is
commented out
//Ret = VImageKit1->PrintDraw->GetDevModeInfo();
if (VImageKit1->PrintDraw->Copies != 3)
VImageKit1->PrintDraw->Copies = 3; //print
3 copies
Ret = VImageKit1->PrintDraw->SetDevModeInfo();
Ret = VImageKit1->PrintDraw->PrintCreateDC(vikDevMode);
if (Ret != false)
{
//printing code
Ret =
VImageKit1->PrintDraw->PrintDeleteDC();
}
Ret = VImageKit1->PrintDraw->ReleaseDevModeHandle();
In Delphi
Ret: Boolean;
VImageKit1.PrintDraw.PrinterName := 'EPSON LP-8200C';
VImageKit1.PrintDraw.PrintFileName := '';
Ret := VImageKit1.PrintDraw.GetDevModeHandle;
if Ret = False then Exit;
//GetDevModeHandle method calls GetDevModeInfo so the next line is
commented out
//Ret := VImageKit1.PrintDraw.GetDevModeInfo;
if VImageKit1.PrintDraw.Copies <> 3 then
VImageKit1.PrintDraw.Copies := 3; //print 3
copiesa
Ret := VImageKit1.PrintDraw.SetDevModeInfo;
Ret := VImageKit1.PrintDraw.PrintCreateDC(vikDevMode);
if Ret <> False then
begin
//printing code
Ret := VImageKit1.PrintDraw.PrintDeleteDC;
end;
Ret := VImageKit1.PrintDraw.ReleaseDevModeHandle;