遇到内存泄露提示应该怎么解决
2017-04-14
展开全部
主要代码在OnTimer函数里,列出如下
C/C++ code
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void CShuaKeDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(1 == nIDEvent) {
if(1 == flag) {
::PostMessage(m_hWebPage, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(m_drag.m_TargetPoint.x, m_drag.m_TargetPoint.y));
::PostMessage(m_hWebPage, WM_LBUTTONUP, MK_LBUTTON, MAKELONG(m_drag.m_TargetPoint.x, m_drag.m_TargetPoint.y));
flag = 2;
}
else if(2 == flag) {
CWnd* m_Dlg = NULL;
m_Dlg = FindWindow(NULL, "来自网页的消息");
if(m_Dlg) {
m_Dlg->PostMessage(WM_KEYDOWN, VK_RETURN, NULL);
m_Dlg->PostMessage(WM_KEYUP, VK_RETURN, NULL);
flag = 1;
}
}
}
CDialog::OnTimer(nIDEvent);
}
然后在运行的时候,不知什么时候就出现个内存泄露~提示在afxwin2.inl的41行。对应位置代码如下
C/C++ code
?
1
{ ASSERT(::IsWindow(m_hWnd)); return ::PostMessage(m_hWnd, message, wParam, lParam); }
C/C++ code
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void CShuaKeDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(1 == nIDEvent) {
if(1 == flag) {
::PostMessage(m_hWebPage, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(m_drag.m_TargetPoint.x, m_drag.m_TargetPoint.y));
::PostMessage(m_hWebPage, WM_LBUTTONUP, MK_LBUTTON, MAKELONG(m_drag.m_TargetPoint.x, m_drag.m_TargetPoint.y));
flag = 2;
}
else if(2 == flag) {
CWnd* m_Dlg = NULL;
m_Dlg = FindWindow(NULL, "来自网页的消息");
if(m_Dlg) {
m_Dlg->PostMessage(WM_KEYDOWN, VK_RETURN, NULL);
m_Dlg->PostMessage(WM_KEYUP, VK_RETURN, NULL);
flag = 1;
}
}
}
CDialog::OnTimer(nIDEvent);
}
然后在运行的时候,不知什么时候就出现个内存泄露~提示在afxwin2.inl的41行。对应位置代码如下
C/C++ code
?
1
{ ASSERT(::IsWindow(m_hWnd)); return ::PostMessage(m_hWnd, message, wParam, lParam); }
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询