U++ framework
Do not panic. Ask here before giving up.

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: 312
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: Tue Sep 29 18:48:54 GMT+2 2026

Total time taken to generate the page: 0.00745 seconds