Mike
Mike

Reputation: 39

Why the WM_GETFONT doesn't work?

Delphi XE2.

For a TForm I do:

hFont := SendMessage(Self.Handle, WM_GETFONT, 0, 0);

But it returns 0. That is, as if the form has a system font. Why is that?

And if I do, for example, like this:

hFont := SendMessage(CheckBox1.Handle, WM_GETFONT, 0, 0);

That returns the correct descriptor.

The same thing, for example, for TPanel - hFont = 0. And for the TButton, the hFont has the correct value.

Upvotes: 2

Views: 527

Answers (1)

Kargath
Kargath

Reputation: 528

https://devblogs.microsoft.com/oldnewthing/20140724-00/?p=413

The WM_SET­FONT and WM_GET­FONT messages are not mandatory. A window may choose to support them, or it may choose not to, or it may even choose to support one but not the other. (Though if it supports WM_SET­FONT, it probably ought to support WM_GET­FONT.)

Upvotes: 2

Related Questions