windows MFC消息demo

1、在BEGIN_MESSAGE_MAP添加MAP映射

BEGIN_MESSAGE_MAP(CdesktopTotalMapDlg, CDialogEx)
	ON_MESSAGE(WM_SYS_NORMAL_MSG, OnSysNormalMessage)

	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_BUTTON_SELECTSOURCEDIR, &CdesktopTotalMapDlg::OnBnClickedButtonSelectsourcedir)
	ON_BN_CLICKED(IDC_BUTTON_SELECTDSTFILE, &CdesktopTotalMapDlg::OnBnClickedButtonSelectdstfile)
	ON_BN_CLICKED(IDC_BUTTON_STARTMARGE, &CdesktopTotalMapDlg::OnBnClickedButtonStartmarge)
END_MESSAGE_MAP()

2、添加头文件声明

LRESULT OnSysNormalMessage(WPARAM wParam, LPARAM lParam );

3、添加OnSysNormalMessage函数定义

LRESULT CdesktopTotalMapDlg::OnSysNormalMessage(WPARAM wParam, LPARAM lParam )
{
	switch (wParam)
	{
	case 0:
		UpdateData(FALSE);
		CEdit*pedit=(CEdit*)GetDlgItem(IDC_EDIT_SHOWLOG);
		int nline=pedit-> GetLineCount();
		pedit-> LineScroll(nline-1);
		break;
	}
	return NULL;
}

4、调用

#define  WM_SYS_NORMAL_MSG_SHOWLOG 0
SYS_PostNormalMsg( WM_SYS_NORMAL_MSG_SHOWLOG , NULL);

你可能感兴趣的:(【道阻且长C++】,【MFC】,windows,mfc,c++)