tout d'abord, bonne année 2010!! j'ai passé la fin d'année avec taz qui était assez gentil pour me permettre à rester dans leur appartement pendant les jours fériés.
I am just starting to appreciate WTL (Windows Template Library). Having developed software for more than a decade using MFC and later C#.NET, I was skeptical about WTL. So far, it is difficult finding a published book on the subject. Thank goodness for C++ developers out there who had been kind enough to post their sample works on the internet.
I am also trying out this cool tip on how to post source code on blogspot. Thanks to
Vivian.
1. Derive from CDialogResize.
class CMainDlg : public CDialogImpl,
public CDialogResize
{
// Put maps here
}
2. Specify the chain message map entry for CDialogResize.
BEGIN_MSG_MAP(CMainDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
CHAIN_MSG_MAP(CDialogResize)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
3. Specify the behaviour of resize for each control in the dialog resize map. DLSZ_SIZE_Y means the control would grow vertically and DLSZ_SIZE_X horizontally.
BEGIN_DLGRESIZE_MAP(CMainDlg)
DLGRESIZE_CONTROL(IDC_TREE_JOBS, DLSZ_SIZE_Y)
DLGRESIZE_CONTROL(IDC_LIST_PIPEELEMENTS, DLSZ_SIZE_X | DLSZ_SIZE_Y)
END_DLGRESIZE_MAP()
4. Initialize CDialogResize
LRESULT CMainDlg::OnInitDialog(UINT, WPARAM, LPARAM, BOOL&)
{
// Init the CDialogResize code
DlgResize_Init();
// center the dialog on the screen
CenterWindow();
As you can see, it does feel like a cross between Win32 API and MFC programming. I liken it to a missing link - the next evolutionary step. As homo sapiens departed from their monkey-like ancestors, WTL departed from its bulky roots and became better in terms of binary output size. The sad news is, as with many species in geological time, some die out. Having heard that MS had long since discontinued support for the technology, I do not see any future for WTL. C'est triste.
I can imagine that it would be extremely difficult for someone who does not have experience in both to pick up WTL. But at the same time, I remember being horrified at Win32 API back in the days of Windows 95. We were even debating whether we ought to use Win32 or stick to what we knew, which at that time, was Turbo C. Had I known then how easy it was to use Win32 I would have seceeded from the argument.
The same could be said today only the debate (in my head) is between MFC and WTL.