Article ID: 192984
Article Last Modified on 12/1/2003
LRESULT OnMsg(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);After adding the message handler function prototype, edit the message map embedded in the class declaration. Add this macro between the BEGIN_MSG_MAP and END_MSG_MAP macros:
MESSAGE_HANDLER(message_id, function_name)Other message map macros are also available. See REFERENCES for articles explaining the implementation of ATL window objects.
class CDlg : public CDialogImpl<CDlg>
{
public:
CDlg();
~CDlg();
enum { IDD = IDD_DLG };
BEGIN_MSG_MAP(CDlg)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_ID_HANDLER(IDOK, OnOK)
COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
MESSAGE_HANDLER(WM_CTLCOLORDLG, OnCtlColorDlg)
END_MSG_MAP()
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl,
BOOL& bHandled);
LRESULT OnCtlColorDlg(UINT uMsg, WPARAM wParam, LPARAM lParam,
BOOL& bHandled);
};
181505 PRB: ATL COM AppWizard Doesn't Offer MFC Support for .EXE
Visual C++ Online Help: Developer Products; Visual C++; C/C++ Language
and C++ Libraries; Active Template Library; Articles; ATL Window
Classes; Implementing a Window
Visual C++ Online Help: Developer Products; Visual C++; C/C++ Language
and C++ Libraries; Active Template Library; Articles; ATL Window
Classes; Implementing a Dialog Box
Visual C++ Online Help: Developer Products; Visual C++; C/C++ Language
and C++ Libraries; Active Template Library; Class Reference; ATL Macros
and Global Functions
Visual C++ 6.0 Online Help: Visual C++ Documentation; Reference;
Microsoft Foundation Class Library and Templates; Active Template
Library; Articles; ATL Window Classes; Implementing a Window; Adding a
Message Handler
Keywords: kbprb kbwizard KB192984