Hi there, I need to find out what kind of text size a user uses in Windows. Like if the user has chosen "Default scale" or "Large Scale" (DPI scaling) in Windows Vista. It should work for Windows generally though, also in XP. Any idea?
Hi there, I need to find out what kind of text size a user uses in Windows. Like if the user has chosen "Default scale" or "Large Scale" (DPI scaling) in Windows Vista. It should work for Windows generally though, also in XP. Any idea?
By this I mean the text that would be used in the caption of a window as an example. I need to know if the user uses a large text and if so make the window wider so that the text fits.
I found this function but I'm not sure if it does what I want: GetSystemMetrics
GetSystemMetrics Function (Windows)
I had the same issue about 7 years ago, can't remember what I did to fix it (not sure if it was before the move to the new board in Aug 2001 and so got lost).
Have you looked at GetTextExtentPoint32() to check the size?
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
GetSystemMetrics() should give you the default height values. I believe this comes from the settings you can alter in the display properties like colors, font sizes, etc.
GetTextExtentPoint32() will give you the font size information for the font that is currently selected into the DC - which has nothing to do with the GetSystemMetrics() information.
I would agree with novacain and use the latter of the two functions.
Thanks, it seems that what you get from GetTextExtentPoint32 is not affected by changing the size of the text that is used in window captions and menus though so it is not what I'm looking for. Similar info could also be got from GetSystemMetrics where you can get the average character width but again it is not what I need.
GetSystemMetrics() should be able to tell you the font and the size of the font for window captions or title bars.
http://msdn.microsoft.com/en-us/libr...95(VS.85).aspx
http://msdn.microsoft.com/en-us/libr...21(VS.85).aspx
There has to be a function in there that does what you want.
Last edited by VirtualAce; 12-12-2009 at 12:56 PM.
Thanks a lot, those works to get the size when the DPI has changed. There is another, perhaps more common way, to change the character size in the display properties though and that does not get reflected in the output of those functions. That setting can be found when you righ-click the desktop, choose properties, appearence tab, and then go to the bottom dropdown list (in XP). Any idea how to get the size based on that?
Last edited by DrSnuggles; 12-12-2009 at 02:04 PM.