Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get font info of a edit control by Win32 API function

Posted on 2006-11-10
4
Medium Priority
?
911 Views
Last Modified: 2013-12-03
Pls show me how to Get font info of a edit control by Win32 API function ?

Thanks.
0
Comment
Question by:Harry_Kewell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 17917091
If you have a pointer to the edit control, call 'GetFont()', e.g.

CEdit* pEdit = ...;

CFont* pFont = pEdit->GetFont();
0
 

Author Comment

by:Harry_Kewell
ID: 17919862
Could we do that in Win32 API (not MFC) ?
0
 
LVL 86

Accepted Solution

by:
jkr earned 750 total points
ID: 17919868
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
 

Author Comment

by:Harry_Kewell
ID: 17924513
Thks jkr. Hope more help from you.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question