进度条引起刷屏的问题
我用了网上的进度条类CProgressWnd,结果进度条显示过程中,程序中的图像(尤其是矢量图)闪的厉害,调试发现是由CProgressWnd中的函数PeekAndPump引起的,函数PeekAndPump如下:
void CProgressWnd::PeekAndPump(BOOL bCancelOnESCkey /*= TRUE*/)
{
if (m_bModal && ::GetFocus() != m_hWnd)
SetFocus();
MSG msg;
while (!m_bCancelled && ::PeekMessage(&msg, NULL,0,0,PM_NOREMOVE))
{
if (bCancelOnESCkey && (msg.message == WM_CHAR) && (msg.wParam == VK_ESCAPE))
OnCancel();
// Cancel button disabled if modal, so we fake it.
if (m_bModal && (msg.message == WM_LBUTTONUP))
{
CRect rect;
m_CancelButton.GetWindowRect(rect);
if (rect.PtInRect(msg.pt))
OnCancel();
}
if (!AfxGetApp()->PumpMessage())
{
::PostQuitMessage(0);
return;
}
}
}
PeekAndPump应该是用来刷新进度条窗口的,结果它居然连图像窗口也刷新了,请问这个问题怎么解决?