This function updates the contents referred to by the handle of the DEVMODE structure.
Parameters
Name | Explanation |
---|---|
hDevMode | The handle of the DEVMODE structure as retrieved by the IKGetDevModeHandle function |
DevModeInfo | A structure (user-defined type) whose member variables contain the retrieved printer information |
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The IKSetDevModeInfo function updates the DEVMODE structure by passing the information set in the DevModeInfo to the handle of the DEVMODE structure. If each of the member variables of DevModeInfo are set to 0 then the update will have no affect. (Except for the Collate member variable). Note: These settings are dependent upon the printer driver. Because of this, it is possible that some of the settings will have no affect or an affect different than expected. For details about the printer driver and its settings, please refer to the printer manufacturer's manual. For more information about the DEVMODE structure please refer to WindowsAPI. For details about the IKPRINT_DEVMODEINFO structure, please refer to the definition of the structure in the Ik10Print.dll, Ik10PrintA.dll, Ik10Print64.dll, Ik10Print64A.dll section.
Sample Code:
(1)C++Builder
HANDLE hDevMode;
IKPRINT_DEVMODEINFO DevModeInfo;
BOOL Ret;
HDC hDC;
hDevMode = IKGetDevModeHandle("EPSON LP-8200C",
NULL);
if (!hDevMode) return;
Ret = IKGetDevModeInfo(hDevMode,
&DevModeInfo);
if (DevModeInfo.Copies != 3)
DevModeInfo.Copies = 3; //sets
the number of copies to 3
Ret = IKSetDevModeInfo(hDevMode,
&DevModeInfo);
hDC = IKPrintCreateDC(NULL, NULL, hDevMode,
2);
if (hDC)
{
//print...
Ret = IKPrintDeleteDC(hDC);
}
Ret = IKReleaseDevModeHandle(hDevMode);
(2)Delphi
hDevMode: THandle;
DevModeInfo: IKPRINT_DEVMODEINFO;
Ret: LongBool;
DC: HDC;
hDevMode := IKGetDevModeHandle('EPSON LP-8200C',
nil);
if hDevMode = 0 then Exit;
Ret := IKGetDevModeInfo(hDevMode,
DevModeInfo);
if DevModeInfo.Copies <> 3 then
DevModeInfo.Copies := 3; //sets
the number of copies to 3
Ret := IKSetDevModeInfo(hDevMode,
DevModeInfo);
DC := IKPrintCreateDC(nil, nil, hDevMode, 2);
if DC <> 0 then
begin
//print...
Ret := IKPrintDeleteDC(DC);
end;
Ret := IKReleaseDevModeHandle(hDevMode);