The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: bint on October 22, 2008, 03:20:10 PM

Title: Associating Font to the Window
Post by: bint on October 22, 2008, 03:20:10 PM
Hi!
How I can declare a one font (Tahoma) global for a window, buttons and other controls? Help me, please.
Title: Re: Associating Font to the Window
Post by: hutch-- on October 22, 2008, 11:08:17 PM
In a dialog its easy, the font face name and the font size are part of a dialog definition. With a lower level Window where you have more manual control you must use different methods that involve the API CreateFont() and SendMessage hWin,WM_SETFONT,0,0 style code for each window.
Title: Re: Associating Font to the Window
Post by: bint on October 23, 2008, 04:03:04 AM
Hi, Hutch--!
Quote from: hutch-- on October 22, 2008, 11:08:17 PM
In a dialog its easy, the font face name and the font size are part of a dialog definition. With a lower level Window where you have more manual control you must use different methods that involve the API CreateFont() and SendMessage hWin,WM_SETFONT,0,0 style code for each window.
Thank you.


CreateWindowEx()
CreateFont()
SendMessage()


Insert it after CreateWindowEx()?
Title: Re: Associating Font to the Window
Post by: hutch-- on October 23, 2008, 07:02:22 AM
With CreateWindowEx()) there are a couple of places you can set font handles, either in the WM_CREATE message processing that is done DURING the CreateWindowEx() call OR after you have done the CreateWindowEx() call using the returned handle. In the WM_CREATE message processing you must use the handkle from the Wndproc call for the main window.
Title: Re: Associating Font to the Window
Post by: bint on October 23, 2008, 05:45:09 PM
Hutch--, than you. I will try the first variant.
Title: Re: Associating Font to the Window
Post by: bint on October 23, 2008, 08:40:35 PM
A-a-a-a, understand! Yes-yes-yes!

if uMsg==WM_CREATE
    CreateFont(xxxxxxx)
    SendMessage hWin,WM_SETFONT,0,0

Thanks.
Title: Re: Associating Font to the Window
Post by: hutch-- on October 24, 2008, 02:45:46 AM
 :bg
Title: Re: Associating Font to the Window
Post by: bint on October 24, 2008, 07:39:16 AM
How i know a height of taskbar of Windows in pixels?
Title: Re: Associating Font to the Window
Post by: hutch-- on October 24, 2008, 08:14:39 AM
Get its handle then use GetClientRect() to get its height.



LOCAL rct:RECT

invoke GetClientRect,hWnd,ADDR rct
mov eax, rct.bottom
Title: Re: Associating Font to the Window
Post by: bint on October 24, 2008, 05:04:50 PM
Thanks, Hutch--!  :U
Title: Re: Associating Font to the Window
Post by: bint on March 30, 2011, 02:15:19 AM
I want to express my great gratitude to you.
Thank you, Steve. The big mans into the little world.