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;
} 第三:调试详情