FindWindow(NULL,_T("加载监视器"));和Error: CWinThread.../...0xC0000005: Access Violation.走一起了,呵呵

第一:在线程内核函数的某一个子操作函数中,调用了:
HWND hwndJZJSQ = FindWindow(NULL,_T("加载监视器"));
if( IsWindow(hwndJZJSQ) )  PostMessage(hwndJZJSQ, WM_CLOSE, 0, 0);
发现:无论“加载监视器”有无,IsWindows均成立,hwndJZJSQ均有值

第二:在执行接下来的一个子操作函数时,Debug下会引起
Error: CWinThread::PumpMessage called when not permitted.
First-chance exception in DCMS3000Main.exe (MFC42D.DLL): 0xC0000005: Access Violation.
Release版本下,会引起崩溃

Debug下一般都会指向该函数的某一行(GetMessage一般都是返回TRUE的):需要注意的是,下述调试点一般会发现:m_msgCur.msg = 0x10; //也即WM_CLOSE消息,为什么它处理不了???
BOOL CWinThread::PumpMessage()
{
 ASSERT_VALID(this);

 if (!::GetMessage(&m_msgCur, NULL, NULL, NULL))
 {
#ifdef _DEBUG
  if (afxTraceFlags & traceAppMsg)
   TRACE0("CWinThread::PumpMessage - Received WM_QUIT.\n");
  m_nDisablePumpCount++; // application must die
   // Note: prevents calling message loop things in 'ExitInstance'
   // will never be decremented
#endif
  return FALSE;
 }

#ifdef _DEBUG
 if (m_nDisablePumpCount != 0)
 {
  TRACE0("Error: CWinThread::PumpMessage called when not permitted.\n");
  ASSERT(FALSE);
 }
#endif

#ifdef _DEBUG
 if (afxTraceFlags & traceAppMsg)
  _AfxTraceMsg(_T("PumpMessage"), &m_msgCur);
#endif

 // process this message

 if (m_msgCur.message != WM_KICKIDLE && !PreTranslateMessage(&m_msgCur))
 {
  ::TranslateMessage(&m_msgCur);
  ::DispatchMessage(&m_msgCur);
 }
 return TRUE;
}                                                                                                                                                                                                                                  第三:调试详情

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值