Why does GetTextFace always return "system"?
- by user545142
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.