Board index » cppbuilder » setting TFont->Handle releases resource

setting TFont->Handle releases resource


2004-11-03 04:45:44 AM
cppbuilder65
Dear Voters;
I need an easy way to prevent the Windows font resource
from being released after setting the TFont->Handle property?
Boba
 
 

Re:setting TFont->Handle releases resource

"Boba" < XXXX@XXXXX.COM >wrote in message
Quote
I need an easy way to prevent the Windows font
resource from being released after setting the
TFont->Handle property?
TFont takes ownership of the font resource. The previous resource assigned
to the Handle is automatically released when assigning a new resource to the
Handle, and the current Handle is automatically freed when the TFont itself
is freed.
Gambit
 

Re:setting TFont->Handle releases resource

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote
...
TFont takes ownership of the font resource. The previous resource
assigned
to the Handle is automatically released when assigning a new resource to
the
Handle, and the current Handle is automatically freed when the TFont
itself
is freed.


Gambit
I see. Thanks.
Related to that: is there a way to tell if hFont is a valid HFONT handle?
Like an API call IsWindow(HWND). Boba
 

{smallsort}

Re:setting TFont->Handle releases resource

"Boba" < XXXX@XXXXX.COM >wrote in message
Quote
Related to that: is there a way to tell if hFont is a valid
HFONT handle? Like an API call IsWindow(HWND).
The only thing I know of is to call GetObject() to get the font's LOGFONT
structure and check if GetObject() fails.
Gambit