Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 923
  • Last Modified:

Get font info of a edit control by Win32 API function

Pls show me how to Get font info of a edit control by Win32 API function ?

Thanks.
0
Harry_Kewell
Asked:
Harry_Kewell
  • 2
  • 2
1 Solution
 
jkrCommented:
If you have a pointer to the edit control, call 'GetFont()', e.g.

CEdit* pEdit = ...;

CFont* pFont = pEdit->GetFont();
0
 
Harry_KewellAuthor Commented:
Could we do that in Win32 API (not MFC) ?
0
 
jkrCommented:
Well, this is the MFC area... ;o)

But, using Win32, that would be

HFONT hFont = (HFONT) SendMessage(hEditCtrl,WM_GETFONT,0,0);

As the docs state:

WM_GETFONT
An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text.

WM_GETFONT
wParam = 0; // not used, must be zero
lParam = 0; // not used, must be zero
 
Parameters
This message has no parameters.

Return Values
The return value is a handle to the font used by the control, or NULL if the control is using the system font.

0
 
Harry_KewellAuthor Commented:
Thks jkr. Hope more help from you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now