win32 - Redraw

Started by
1 comment, last by aboeing 18 years, 10 months ago
Hi, I'm trying to redraw a window from another thread, and it doesn't seem to be working. I have a dialoge box with a progress bar in it, and a background thread doing some grunt work. I want to update the progress bar, and an edit box, but the window never seems to redraw. I've tried:

	ShowWindow(g_progress_hWnd, SW_SHOW); 
	UpdateWindow(g_progress_hWnd);
	RedrawWindow(g_progress_hWnd,0,0,RDW_UPDATENOW);
none of which seem to have any effect... I've checked that g_progress_hWnd is correct, and put a printf in WM_PAINT - nothing seems to ever happen.. Any advice would be appreciated. Thanks.
Advertisement
Use the InvalidateRect(window handler, null, true) for redrawing the window you want.
UpdateWindow sends an WM_PAINT but if there is nothing to update nothing will be changed in the window, InvalidateRect tells the API which area in the client window needs to be updated(null for entire window). Check the SDK for more info.
There is nothing that can't be solved. Just people that can't solve it. :)
Ah! Excellent, it worked! Thank you!

This topic is closed to new replies.

Advertisement