对话框工程:在wince下WM_ERASEBKGND导致的内存不断增加,以下包括添加的所有代码
逸萌 2009-03-04 08:49:29 我是在ListCtrl中映射WM_ERASEBKGND后不断Invalidate ListCtrl发现的问题,
然后写的对话框工程就加了这些代码,发现确实添加WM_ERASEBKGND消息映射导致,只要注释ON_WM_ERASEBKGND()
就不存在问题!请问如何在添加WM_ERASEBKGND消息处理不导致内存不断增加。
BEGIN_MESSAGE_MAP(CListctrltestDlg, CDialog)
//{{AFX_MSG_MAP(CListctrltestDlg)
ON_WM_ERASEBKGND()
ON_WM_TIMER()
//}}AFX_MSG_MAP
ON_MESSAGE(WM_RefreshUIDataStream, OnRefreshUIDataStream)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CListctrltestDlg message handlers
BOOL CListctrltestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
CenterWindow(GetDesktopWindow()); // center to the hpc screen
// TODO: Add extra initialization here
//PostMessage(WM_RefreshUIDataStream);
SetTimer(111,10,NULL);
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CListctrltestDlg::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
//return TRUE;也内存不断增加
return CDialog::OnEraseBkgnd(pDC);
}
void CListctrltestDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent == 111)
{
Invalidate();
UpdateWindow();
}
CDialog::OnTimer(nIDEvent);
}