` Printed Icetips Article

Icetips Article



Windows API: Get font size resolution
2003-04-29 -- Larry Sand
 
Newsgroups: comp.lang.clarion


Michael D. Brooks wrote:
| Can anyone recomment the best call to use to determine the screen resolution
| and font size use?
|
| I need to get this information for automatic window sizing.
|

Michael,

GetDeviceCaps() for the screen resolution


and something like:

myhDC = GetDC(0)
PrevMapMode = SetMapMode(myhDC, MM_TEXT)
GetTextMetrics(myhDC, tm)
PrevMapMode = SetMapMode(myhDC, PrevMapMode)

! tm is a text metric structure,
! tm.tmHeight is the size of the desktop windows font in pixels

ReleaseDC(0,MyhDC)

for the font size.

Cheers,
Larry Sand



Printed November 23, 2024, 5:50 am
This article has been viewed/printed 35206 times.
Google search has resulted in 32 hits on this article since January 25, 2004.