Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the number of Pixels per Inch standard on all Windows PC displays? (LogPixelsX) in the GetDeviceCaps WinAPI call

Tags:

windows

dpi

By Windows PC displays, I am not referring to Windows CE, or handhelds, etc.

Clarification
Some folks below mistakenly thought I was asking what the DPI (dots per inch) was on monitors. What I'm asking for is the value for LogPixelsX in the GetCaps API call :

LOGPIXELSX Number of pixels per logical inch along the screen width.

In the examples I've seen, it's set to 88, regardless of the screen DPI. Seems to be a Magic Number sort of constant.

In a related Question I'm using GetDeviceCaps to calculate current Screen Font DPI. The code samples I found all have:

Const LOGPIXELSX = 88

Is this universally the same for all monitors (even widescreen vs regular monitors)? And if not, how do I find it for the current display. (MSDN indicates that it's the same for all monitors on a particular computer.

In a system with multiple display monitors, this value is the same for all monitors.

like image 249
Clay Nichols Avatar asked Mar 14 '09 04:03

Clay Nichols


People also ask

Where does 96 DPI come from in Windows?

Microsoft began writing its software to treat the screen as though it provided a PPI characteristic that is 4⁄3 of what the screen actually displayed. Because most screens at the time provided around 72 PPI, Microsoft essentially wrote its software to assume that every screen provides 96 PPI (because 72 × 4⁄3 = 96).

How many pixels per inch is 1920x1080?

24” 1920 x 1200: The ppi is 94 pixels per inch. 15.6” 1920 x 1080: The ppi is 141 pixels per inch.

How many pixels per inch does a typical computer monitor use?

Typical circa-2000 cathode ray tube or LCD computer displays range from 67 to 130 PPI, though desktop monitors have exceeded 200 PPI and contemporary small-screen mobile devices often exceed 300 PPI, sometimes by a wide margin.

What is the default Windows DPI?

DPI setting controls the size of the text, apps and icons. A lower DPI setting will make them appear smaller and a higher setting will make them appear bigger. By default Windows has setting of 96 DPI.


1 Answers

To answer your clarification of the question:

LOGPIXELSX is the parameter you pass to GetDeviceCaps to get the current monitor resolution (technically the horizontal resolution, but all modern displays have equal horizontal and vertical resolution). Yes, it is always 88 - if you wanted to get a different value from GetDeviceCaps, you'd pass in a different value. For example, to get the number of bits per pixel, you'd pass the BITSPIXEL constant which is 12. These magic constants are defined in the Windows API file WINGDI.h.

The note in MSDN is referring not to the parameter, but the returned value.

like image 145
Mark Ransom Avatar answered Oct 06 '22 00:10

Mark Ransom