Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Getting printer orientation?
« Reply #3 on: Sep 1st, 2015, 9:22pm » |
|
on Sep 1st, 2015, 7:20pm, Monkfish wrote:| Thank you. That works perfectly ;D |
|
For completeness, here's the somewhat more complicated LB-compatible version:
Code: struct pd, lStructSize as long, hwndOwner as ulong, hDevMode as ulong, hDevNames as ulong, _
hDC as ulong, Flags as long, nFromPage as short, nToPage as short, nMinPage as short, _
nMaxPage as short, nCopies as short, hInstance as ulong, lCustData as long, _
lpfnPrintHook as long, lpfnSetupHook as long, lpPrintTemplateName as ptr, _
lpSetupTemplateName as ptr, hPrintTemplate as ulong, hSetupTemplate as ulong
pd.lStructSize.struct = len(pd.struct)
pd.Flags.struct = _PD_RETURNDEFAULT or _PD_RETURNDC
calldll #comdlg32, "PrintDlgA", pd as struct, result as long
hDCprt = pd.hDC.struct
calldll #gdi32, "GetDeviceCaps", hDCprt as ulong, _HORZRES as long, width as long
calldll #gdi32, "GetDeviceCaps", hDCprt as ulong, _VERTRES as long, height as long
if height > width then
print "Portrait"
else
print "Landscape"
end if Richard.
|