WTL : how to catch button msg
Hi,
I know it's not a WTL newsgroup but generally people writing MFC has
also a knwoledge of WTL.
I have a simple Dialog Class defined like this :
class CMainDlg : public CDialogImpl<CMainDlg>,
public CWinDataExchange<CMainDlg>
{
public:
BEGIN_MSG_MAP(CMainDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
ALT_MSG_MAP(1)
MSG_WM_SETCURSOR(OnUpdateBtn)
END_MSG_MAP()
enum { IDD = IDD_MAINDLG };
CMainDlg::CMainDlg() :
m_wndUpdateBtn(this, 1){}
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
return ::IsDialogMessage(m_hWnd, pMsg);
}
LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
/*lParam*/, BOOL& bHandled)
{
return bHandled = FALSE;
}
LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/,
BOOL& /*bHandled*/)
{
EndDialog(wID);
return 0;
}
LRESULT OnUpdateBtn(HWND hwndCtrl, UINT uHitTest, UINT uMouseMsg)
{
::MessageBox(NULL, _T("fdfsdf"), _T(""), 0);
return 0;
}
protected:
CContainedWindow m_wndUpdateBtn;
};
But when i click on my Update Btn nothings happens.
Any idea ?