This method updates the contents referred to by the handle of the DEVMODE structure.
Parameters
None
Return Value
Returns True (nonzero) when successful, returns False (0) 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:
Visual Basic
Dim Ret As Boolean
ImageKit1.PrintDraw.PrinterName = "EPSON LP-8200C"
ImageKit1.PrintDraw.PrintFileName = ""
Ret = ImageKit1.PrintDraw.GetDevModeHandle
If Ret = False Then Exit Sub
'GetDevModeHandle method calls GetDevModeInfo so the next line is commented out
'Ret = ImageKit1.PrintDraw.GetDevModeInfo
If ImageKit1.PrintDraw.Copies <> 3 Then
ImageKit1.PrintDraw.Copies = 3
End If
Ret = ImageKit1.PrintDraw.SetDevModeInfo
Ret = ImageKit1.PrintDraw.PrintCreateDC(ikDevMode)
If Ret <> False Then
'printing code
Ret = ImageKit1.PrintDraw.PrintDeleteDC
End If
Ret = ImageKit1.PrintDraw.ReleaseDevModeHandle
Visual C++
BOOL Ret;
ImageKit1.GetPrintDraw().SetPrinterName("EPSON LP-8200C");
ImageKit1.GetPrintDraw().SetPrintFileName("");
Ret = ImageKit1.GetPrintDraw().GetDevModeHandle();
if (Ret == FALSE) return;
//GetDevModeHandle method calls GetDevModeInfo so the next line is commented out
//Ret = ImageKit1.GetPrintDraw().GetDevModeInfo();
if (ImageKit1.GetPrintDraw().GetCopies() != 3)
ImageKit1.GetPrintDraw().SetCopies(3);
Ret = ImageKit1.GetPrintDraw().SetDevModeInfo();
Ret = ImageKit1.GetPrintDraw().PrintCreateDC(ikDevMode);
if (Ret != false)
{
//printing code
Ret = ImageKit1.GetPrintDraw().PrintDeleteDC();
}
Ret = ImageKit1.GetPrintDraw().ReleaseDevModeHandle();