.h部分
class CMFCDlg : public CDialogEx
{
// 构造
public:
CMFCDlg(CWnd* pParent = nullptr); // 标准构造函数
CBitmapButton m_WorkBtn[9];
// 对话框数据
#ifdef AFX_DESIGN_TIME
enum { IDD = IDD_MFC_DIALOG };
#endif
afx_msg void OnBtnWork00();
afx_msg void OnBtnWork01();
afx_msg void OnBtnWork02();
afx_msg void OnBtnWork03();
afx_msg void OnBtnWork04();
afx_msg void OnBtnWork05();
afx_msg void OnBtnWork06();
afx_msg void OnBtnWork07();
......
.CPP部分
void CMFCDlg::DoDataExchange(CDataExchange* pDX)
{
for (int i = 0; i < 8; i++)
{
DDX_Control(pDX, IDC_MAI_BTNWORK00 + i, m_WorkBtn[i]);
}
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CMFCDlg, CDialogEx)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_MAI_BTNWORK00, &CMFCDlg::OnBtnWork00)
ON_BN_CLICKED(IDC_MAI_BTNWORK01, &CMFCDlg::OnBtnWork01)
ON_BN_CLICKED(IDC_MAI_BTNWORK02, &CMFCDlg::OnBtnWork02)
ON_BN_CLICKED(IDC_MAI_BTNWORK03, &CMFCDlg::OnBtnWork03)
ON_BN_CLICKED(IDC_MAI_BTNWORK04, &CMFCDlg::OnBtnWork04)
ON_BN_CLICKED(IDC_MAI_BTNWORK05, &CMFCDlg::OnBtnWork05)
ON_BN_CLICKED(IDC_MAI_BTNWORK06, &CMFCDlg::OnBtnWork06)
ON_BN_CLICKED(IDC_MAI_BTNWORK07, &CMFCDlg::OnBtnWork07)
END_MESSAGE_MAP()
void CMFCDlg::OnBtnWork00() { }
void CMFCDlg::OnBtnWork01() { }
void CMFCDlg::OnBtnWork02() { }
void CMFCDlg::OnBtnWork03() { }
void CMFCDlg::OnBtnWork04() { }
void CMFCDlg::OnBtnWork05() { }
void CMFCDlg::OnBtnWork06() { }
void CMFCDlg::OnBtnWork07() { }
..............
这个程序在编译的时候没有问题,但是执行的时候就会报中断