2024-02-06

WIN32API - How to know if the printer has Duplex capabilities



******************************************************************** FUNCTION PR_IsDuplex LPARAMETERS m.tcPrinter ******************************************************************** #DEFINE DC_DUPLEX 7 *!* * https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-devicecapabilitiesa *!* int DeviceCapabilitiesA( *!* [in] LPCSTR pDevice, *!* [in] LPCSTR pPort, *!* [in] WORD fwCapability, *!* [out] LPSTR pOutput, *!* [in] const DEVMODEA *pDevMode *!* ) * DC_DUPLEX * If the printer supports duplex printing, the return value is 1; otherwise, the return value is zero. * The pOutput parameter is not used. LOCAL lnDuplex, llIsDuplex DECLARE Long DeviceCapabilities IN winspool.drv as xfcDeviceCapabilities ; String pDevice, String pPort, Long fwCapability, ; String @pOutput, Long pDevMode TRY m.lnDuplex = xfcDeviceCapabilities(m.tcPrinter, "", DC_DUPLEX, "", 0) m.llIsDuplex = IIF(lnDuplex = 1, .T., .F.) CATCH TO m.loExc m.llIsDuplex = .F. ENDTRY RETURN m.llIsDuplex ENDFUNC


No comments:

Post a Comment