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.
Harry_KewellAsked:
Who is Participating?
 
jkrConnect With a Mentor Commented:
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
 
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
 
Harry_KewellAuthor Commented:
Thks jkr. Hope more help from you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.