Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get a rect by GetClientRect,to my suprise is below:
rect.width=1401 ,however my screen is 1366*768 .What is the unit of rect.width? Is it inch or other?
Posted
Comments
Richard MacCutchan 21-Oct-14 10:23am    
Units are pixels. Are you sure you are reading the values correctly?
CHill60 21-Oct-14 10:36am    
Without any context - have you changed the mapping mode so that the Logical co-ordinates no longer match the device units?
codeprojectddx 21-Oct-14 19:05pm    
yes ,i really changed the mapping mode.Now I modify the mapping mode MM_TEXT,when I maxizime the window I find the rect.width is 1366 and the rect.height is 686. Thank you for your answer.
[no name] 21-Oct-14 20:56pm    
Good call. I would not have thought of that.
Leo Chapiro 21-Oct-14 10:41am    
The unit is pixel. What do you get by GetWindowRect ?

Posting (my) solution embedded in the comments ... User had changed the mapping mode[^] so the Logical co-ordinates no longer matched the device units.

Changing the mapping to MM_TEXT brought the two measurements into line.

Some reference material:

GDI Mapping[^]
Device Independent Pixels[^]
Co-ordinate spaces and Transformation[^]
 
Share this answer
 
it is in pixel. Looks like your Windows is bigger than the screen. Check where you set the size.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900