Home
> Windows API > Changing font of all child controls at one go!
Changing font of all child controls at one go!
Ever felt the need to change the font of all child controls of a dialog, or a window, and you had to use GetWindow, GetNextWindow and stuff like that to set a font for a window. Well here is an easy way!
// Idea taken from MSDN... BOOL CSomeDialog::OnInitDialog() { // I am using a static font for demo purpose only, make sure // you have this as a member static CFont fnt; CDC dc; dc.Attach( GetDC()->GetSafeHdc() ); fnt.CreatePointFont( 100, _T( "Courier new" ), &dc ); // Set change font message to all child windows SendMessageToDescendants( GetSafeHwnd(), WM_SETFONT, (WPARAM)fnt.GetSafeHandle(), MAKELONG(WORD( TRUE ), 0 ), true, false ); }// End OnInitDialog
Comments (0)
Trackbacks (0)
Leave a comment
Trackback
The Old Rugged Cross
Daily Manna
Subscribe to get a bible verse everyday on your mobile for free.
Copyright and Disclaimer
Copyright: ©Nibu Babu Thomas and bit and bytes [2007 - 2009]. Unauthorized use and/or duplication of this material without express and written permission from this blog’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Nibu Babu Thomas and bits and bytes with appropriate and specific direction to the original content.
Disclaimer: These postings are provided "AS IS" with no warranties, and confer no rights.
Disclaimer: These postings are provided "AS IS" with no warranties, and confer no rights.
Categories
- .net (24)
- C# (16)
- VB (12)
- WindowsIdentity (1)
- WPF (1)
- ActiveDirectory (1)
- ActiveX (2)
- Announcements (4)
- ATL (5)
- Books (1)
- C Programming (14)
- C++, VC++ (96)
- CodeProject (1)
- COM (20)
- Debugging (31)
- Development Tools (5)
- DevTools (1)
- DOS (2)
- General (14)
- MVP Stuff (1)
- MVP Summit 2008 (5)
- HTML (1)
- Interop (2)
- Interview Questions (4)
- C++ (1)
- MFC (60)
- Microsoft (8)
- Windows 8 (2)
- Windows 8 Apps (1)
- Windows Phone (2)
- Microsoft Office (1)
- My thoughts (3)
- Networking (1)
- Parallel Programming (1)
- Polls (2)
- PowerShell (10)
- Sharepoint (9)
- SQL (1)
- STL (1)
- STL (1)
- STL (1)
- STL (1)
- STL (1)
- Strange bugs (6)
- Uncategorized (2)
- Undocumented WinAPI (6)
- Visual C++ Compiler (5)
- Visual studio (37)
- Visual Studio 2012 (3)
- Visual Studio 2013 (7)
- Win32Controls (1)
- WinDbg (9)
- Windows (24)
- Batch programming (4)
- Explorer (1)
- SysInternals (1)
- Tools (3)
- Windows 10 (1)
- Windows API (191)
- Windows Phone (2)
- WPF (1)
- XML (1)
- XPath (1)
.net
ActiveX
ATL
bugs
CComboBox
CDialog
CFileDialog
Clipboard
COleSafeArray
COM
Console API
Console Application
cout
CreateProcess
CString
Debug
Debugger
Debugging
dumpbin
Feature pack
GDI
GetProcAddress
GetSystemMenu
GetSystemMetrics
idl
Interview questions
iterator
MAKEINTRESOURCE
MessageBox
MVP
MVP Summit
MVP Summit 2008
Nibu
Nibu babu thomas
Nibu Thomas
OnInitDialog
OpenProcessToken
PowerShell
Ray Ozzie
Redmond
SetBkMode
SetWindowPos
Sharepoint
ShellExecuteEx
SHELLEXECUTEINFO
SHFILEINFO
ShGetFileInfo
std
std::string
Steve Ballmer
stl
Strange bugs
Summit
SysInternals
SystemParametersInfo
TextOut
UNICODE
VC++ Compiler option
VC6
VC8
VC9
vector
Vista API's
Visual studio
Visual Studio 2013
VS2005
VS2008
VS2013
Watch window
windbg
Windows
Windows Phone
WM_SYSCOMMAND
XP
XP Themes