Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » How to get pixels per millimeter for current screen?
Re: How to get pixels per millimeter for current screen? [message #36063 is a reply to message #36045] Sun, 22 April 2012 21:48 Go to previous message
BioBytes is currently offline  BioBytes
Messages: 310
Registered: October 2008
Location: France
Senior Member
Hi,

If you're using Windows, a call to WinAPI32 is possible using the following code:

HDC screen = GetDC(NULL); 
int hSize=GetDeviceCaps(screen,HORZSIZE); int hRes=GetDeviceCaps

(screen,HORZRES); float PixelsPerMM=(float)hRes/hSize;// pixels per millimeter float 

PixelsPerInch=PixelsPerMM*25.4; //dpi 


GetDeviceCaps is a function that also gives information on printers resolution.

Regards Smile

Biobytes
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Zooming layout in Windows
Next Topic: Storing / Inserting Data per BIT
Goto Forum:
  


Current Time: Sat Jul 05 09:33:33 CEST 2025

Total time taken to generate the page: 0.03609 seconds