Click here to Skip to main content
15,915,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Firewall question Pin
Kuniva19-Jun-03 11:36
Kuniva19-Jun-03 11:36 
GeneralRe: Firewall question Pin
Joel Lucsy19-Jun-03 14:34
Joel Lucsy19-Jun-03 14:34 
GeneralRe: Firewall question Pin
Robert Little19-Jun-03 8:04
Robert Little19-Jun-03 8:04 
Generalcapture wm_char message Pin
lucy19-Jun-03 7:19
lucy19-Jun-03 7:19 
GeneralRe: capture wm_char message Pin
Kuniva19-Jun-03 7:38
Kuniva19-Jun-03 7:38 
GeneralRe: capture wm_char message Pin
lucy19-Jun-03 8:00
lucy19-Jun-03 8:00 
Questionverify packets sent over com port? Pin
pramodastro19-Jun-03 7:05
pramodastro19-Jun-03 7:05 
GeneralPixel to inch conversion (just some basic maths) Pin
User 665819-Jun-03 7:04
User 665819-Jun-03 7:04 
Hi
I want to know the physical size of my monitor in inches/millimeters/centimeters. This is what I do currently:
CDC dcDisplay;
	if(!dcDisplay.CreateDC("DISPLAY", NULL, NULL, NULL))
	{
		MessageBox("Failed to get display DC.", "Error", MB_OK|MB_ICONEXCLAMATION);
		ExitProcess(0);
	}

// Get DPI, 96 on my display
int xDPI = dcDisplay.GetDeviceCaps(LOGPIXELSX);
int yDPI = dcDisplay.GetDeviceCaps(LOGPIXELSY);

// resolution, 1280x960 on my display
int xRes = dcDisplay.GetDeviceCaps(HORZRES);
int yRes = dcDisplay.GetDeviceCaps(VERTRES);

// 13 Inches on my display, equals 330.2mm and 33,02cm
int xInches = xRes / xDPI;
// 10 Inches on my display, equals 254mm and 25,4cm
int yInches = yRes / yDPI;

const double dInchToMillimeter = 25.4;

// 330,2 mm
double xMillimeter = xInches * dInchToMillimeter;
// 254 mm
double yMillimeter = yInches * dInchToMillimeter;


So I get 13 Inches horizontal (330,2 mm) and 10 Inches vertical (254 mm).
But there's another method, that outputs something different:
int xMillimeter = dcDisplay.GetDeviceCaps(HORZSIZE);
int yMillimeter = dcDisplay.GetDeviceCaps(VERTSIZE);


Outputs 320 mm horizontal and 240 millimeters vertical.
Which method is more trustful? One more thing: If I measure
my display with a ruler it seems that all values determined by both functions are too small, e.g. it seems that my display has a width of at least 350 mm and a height of at least 260 mm Confused | :confused:

regards

modified 12-Sep-18 21:01pm.

GeneralRe: Pixel to inch conversion (just some basic maths) Pin
Anonymous19-Jun-03 7:15
Anonymous19-Jun-03 7:15 
GeneralRe: Pixel to inch conversion (just some basic maths) Pin
Ryan Binns19-Jun-03 17:49
Ryan Binns19-Jun-03 17:49 
GeneralEXE's ICON Pin
Eldon Zacek19-Jun-03 6:14
Eldon Zacek19-Jun-03 6:14 
GeneralRe: EXE's ICON Pin
Anonymous19-Jun-03 6:49
Anonymous19-Jun-03 6:49 
GeneralRe: EXE's ICON Pin
Anonymous19-Jun-03 6:51
Anonymous19-Jun-03 6:51 
GeneralRe: EXE's ICON Pin
Brian Delahunty19-Jun-03 7:22
Brian Delahunty19-Jun-03 7:22 
GeneralOnNewDocument Pin
doctorpi19-Jun-03 5:52
doctorpi19-Jun-03 5:52 
GeneralRe: OnNewDocument Pin
John M. Drescher19-Jun-03 6:01
John M. Drescher19-Jun-03 6:01 
GeneralRe: OnNewDocument Pin
doctorpi19-Jun-03 6:26
doctorpi19-Jun-03 6:26 
GeneralMFC with message map versus old method Pin
Member 14615719-Jun-03 4:35
Member 14615719-Jun-03 4:35 
GeneralRe: MFC with message map versus old method Pin
AlexO19-Jun-03 4:40
AlexO19-Jun-03 4:40 
GeneralRe: MFC with message map versus old method Pin
John M. Drescher19-Jun-03 5:09
John M. Drescher19-Jun-03 5:09 
GeneralRe: MFC with message map versus old method Pin
Cambalindo19-Jun-03 5:49
Cambalindo19-Jun-03 5:49 
GeneralRe: MFC with message map versus old method Pin
Member 14615719-Jun-03 5:55
Member 14615719-Jun-03 5:55 
GeneralRe: MFC with message map versus old method Pin
Cambalindo19-Jun-03 6:08
Cambalindo19-Jun-03 6:08 
GeneralRe: MFC with message map versus old method Pin
basementman19-Jun-03 8:06
basementman19-Jun-03 8:06 
GeneralRe: MFC with message map versus old method Pin
Cambalindo19-Jun-03 9:54
Cambalindo19-Jun-03 9:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.