Creating a dialog from it’s template!

Here is a sample on how to do it…

[sourcecode language=’cpp’]CDialogTemplate dlgTemplate;
// Load dialog template into memory
// Change font of dialog
dlgTempl.SetFont( _T( “Courier” ), 10 );

// Creates and displays a modal dialog from a template in memory
CDialog dlg;
dlg.InitModalIndirect( dlgTemplate.m_hTemplate, 0 );

What’s the use of this? Well you can change the font of dialog at runtime? Just call dlgTemplate.SetFont. This changes the font of entire dialog. Cool isn’t it!

To use CDialogTemplate include “afxpriv.h”. Microsoft(R) says that this file could be changed in near future, so use with care.

Appreciate your comments...