[REBOL] Re: Display device DPI
From: greggirwin:mindspring at: 22-Oct-2002 11:13
Hi Ashley,
The video driver is what determines the DPI for your screen. It doesn't
matter what kind of monitor you have (though some LCDs provide their own
driver so...)
Here are some historical DPI values for common video settings:
EGA 72 dpi
VGA 96 dpi
SVGA 96 dpi
8514 Large 120 dpi
8514 Small 96 dpi
If you change to Large Fonts on Windows, you should see the DPI change as
well (from 96 to 120).
Brett got you in the ballpark with GetDeviceCaps. The elements you're
interested in are LOGPIXELSX/Y. If you have View/Pro, try the following and
let me know if it works.
--Gregg
win-user: load/library %user32.dll
win-gdi: load/library %gdi32.dll
get-dc: make routine! [
hWnd [integer!] ; handle to window; 0 for screen DC
return: [integer!]
] win-user "GetDC"
get-device-caps: make routine! [
hDC [integer!] ; handle to DC
Index [integer!] ; index of capability
return: [integer!]
] win-gdi "GetDeviceCaps"
LOGPIXELSX: 88
LOGPIXELSY: 90
; Have to use an intermediate variable here. REBOL doesn't like
; using the return result inline.
print screen-dc: get-dc 0
print get-device-caps screen-dc LOGPIXELSX
print get-device-caps screen-dc LOGPIXELSY