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
How can I get a value from WinAPI
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
> 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
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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:
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
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Pupil.
You're right, my bad, i missed that part when browsing the win api.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.