Why does GetTextFace always return "system"?
Posted
by
user545142
on Stack Overflow
See other posts from Stack Overflow
or by user545142
Published on 2010-12-31T11:11:41Z
Indexed on
2010/12/31
11:54 UTC
Read the original article
Hit count: 238
I am trying to get the font of controls in other applications.
When I try WM_GETFONT
, it returns 0. This my code:
[DllImport("User32.DLL")] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
IntPtr fx = SendMessage(button1.Handle, 0x31, 0, 0);
When I use GetTextFace
with a button, it always returns "system". This is my code:
StringBuilder Buff = new StringBuilder(256);
IntPtr dc = GetDCEx(button1.Handle, IntPtr.Zero, DeviceContextValues.Window
|DeviceContextValues.Cache | DeviceContextValues.ClipSiblings | DeviceContextValues.IntersectRgn);
IntPtr hfont = GetTextFace(dc, 256, Buff);
Of course I'm sure I changed the font type.
How can I solve this problem?
I am using C# under Windows 7.
© Stack Overflow or respective owner