鼠标单击的时候,MessageBox 没反应
#pragma once#include "resource.h"
// CMyDialog 对话框class CMyDialog : public CDialog
{
DECLARE_DYNAMIC(CMyDialog)public:
CMyDialog(CWnd* pParent = NULL);   // 标准构造函数
virtual ~CMyDialog();// 对话框数据
enum { IDD = IDD_DIALOG1 };protected:
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
public:
afx_msg void OnLButtonDown(UINT,CPoint);
DECLARE_MESSAGE_MAP()
};
// MyDialog.cpp : 实现文件
//#include "stdafx.h"
#include "MyDialog.h"
// CMyDialog 对话框IMPLEMENT_DYNAMIC(CMyDialog, CDialog)CMyDialog::CMyDialog(CWnd* pParent /*=NULL*/)
: CDialog(CMyDialog::IDD, pParent)
{}CMyDialog::~CMyDialog()
{
}void CMyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
END_MESSAGE_MAP()
// CMyDialog 消息处理程序
void CMyDialog::OnLButtonDown (UINT,CPoint)
{
MessageBox(L"");
}

解决方案 »

  1.   

    BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
    ON_WM_LBUTTONDOWN()
    END_MESSAGE_MAP()
      

  2.   

    MESSAGE_MAP里面没加消息啊
      

  3.   

    1>------ 已启动生成: 项目: WIN32, 配置: Debug Win32 ------
    1>正在编译...
    1>MyDialog.cpp
    1> WINVER not defined. Defaulting to 0x0600 (Windows Vista)
    1>c:\users\administrator\desktop\win32\win32\mydialog.cpp(31) : error C2084: 函数“const AFX_MSGMAP *CMyDialog::GetMessageMap(void) const”已有主体
    1>        c:\users\administrator\desktop\win32\win32\mydialog.h(21) : 参见“GetMessageMap”的前一个定义
    1>c:\users\administrator\desktop\win32\win32\mydialog.cpp(31) : error C2084: 函数“const AFX_MSGMAP *CMyDialog::GetThisMessageMap(void)”已有主体
    1>        c:\users\administrator\desktop\win32\win32\mydialog.h(21) : 参见“GetThisMessageMap”的前一个定义
    1>生成日志保存在“file://c:\Users\Administrator\Desktop\WIN32\WIN32\Debug\BuildLog.htm”
    1>WIN32 - 2 个错误,0 个警告
    ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
      

  4.   

    这个代码全部是你自己输入的吗?好像消息没有映射。
    这样试试:BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
    ON_WM_LBUTTONDOWN()
    END_MESSAGE_MAP()