Page 1 of 1

Posted: Wed Oct 23, 2002 5:36 pm
by BackupUser
Restored from previous forum. Originally posted by Kaba.

Hi!

To adjust the layout of my windows, I should know the size of the default system font, set by the user.

I found in the winapi the command GetTextMetrics() which allows me to read from the TEXTMETRIC Structure. There I'd like to read the value stored in tmHeight.

How does this work in PureBasic? What do I do wrong?
I've tried: fntheight.l = GetTextMetrics_(hwnd,tmheight.TEXTMETRIC)
but just got strange results, like "4218818"

Can anybody give me a hint? I'm using Win98SE

Thx

Kaba

Posted: Wed Oct 23, 2002 7:14 pm
by BackupUser
Restored from previous forum. Originally posted by PB.

> To adjust the layout of my windows, I should know the size of the
> default system font, set by the user.

See here:

viewtopic.php?t=2021


PB - Registered PureBasic Coder

Posted: Wed Oct 23, 2002 7:25 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

You have to access the tmHeigt element within the structure TEXTMETRIC. So you do it like this:

Code: Select all

if GetTextMetrics_(UseWindow(yourwindownumber), @metrics.TEXTMETRIC)
  fontheight.l = metrics\tmHeight ; acces the element within structure
endif

Posted: Wed Oct 23, 2002 7:28 pm
by BackupUser
Restored from previous forum. Originally posted by Kaba.

GREAT!!!!! 8)

Thank you very much! You really help me a lot!! :)

Kaba

Posted: Wed Oct 23, 2002 7:36 pm
by BackupUser
Restored from previous forum. Originally posted by Kaba.

@pupil: Thanks! I really understand this stuff now! :)

Posted: Thu Oct 24, 2002 5:53 am
by BackupUser
Restored from previous forum. Originally posted by fweil.

hello,

As GetTextMetrics_() requires a device context the working syntax should be :

GetTextMetrics_(GetWindowDC_(WindowID()), @metrics.TEXTMETRICS) ...

Not sure to be right but I think so.

Rgrds

Francois Weil
14, rue Douer
F64100 Bayonne

Posted: Thu Oct 24, 2002 9:12 am
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by fweil

hello,

As GetTextMetrics_() requires a device context the working syntax should be :

GetTextMetrics_(GetWindowDC_(WindowID()), @metrics.TEXTMETRICS) ...

Not sure to be right but I think so.
You're right, my bad, i missed that part when browsing the win api.