Reputation:
I've a Visual C++ project but I don't be able to refresh the window and redraw itself. I've used
RedrawWindow();
m_ProgressDlg->RedrawWindow();
and also
UpdateData(false);
m_ProgressDlg->UpdateData(false);
but never seems go well.
How can I do?
Upvotes: 0
Views: 17160
Reputation: 193
You might also be trying to call Invalidate() and RedrawWindow() while m_hWnd is NULL, if by "not going well" means crashing. Try:
if (m_hWnd)
{
Invalidate();
RedrawWindow();
}
(I know this is old, but some of us still have one foot stuck in the MFC muck.)
Upvotes: 0
Reputation: 4432
For client area use InvalidateRect + UpdateWindow. If you want to redraw the non-client area of the window, try calling SetWindowPos with SWP_DRAWFRAME | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE.
Upvotes: 2
Reputation:
But in release version it doesn't function correctly also if with openeed worspace it seem to go
Upvotes: 0
Reputation: 2317
You could use UpdateWindow in conjunction with InvalidateRect to get an immediate redraw.
Upvotes: 5
Reputation:
::InvalidateRect(hwnd, NULL, TRUE) WinAPI function (or wnd->InvalidateRect(NULL) method) should do the trick: it invalidates client area and causes the system to send WM_PAINT to the window to redraw it. If you want immediate redraw, you should also call UpdateWindow() just after invalidation.
Upvotes: 1
Reputation: 308206
Looks like you're using MFC.
I believe your app is busy and not processing messages from the queue, so it's not processing the WM_PAINT that would update the window.
Use the RDW_UPDATENOW parameter with RedrawWindow to force the repaint, even when your window is busy.
Upvotes: 1