moving a control in a window

I want to move a control within a window. How can I repaint the area uncovered by moving control in the window. I tried several ways but they didn't work.
[159 byte] By [dullboy] at [2007-11-18 17:38:38]
# 1 Re: moving a control in a window
So are you asking how to move a control or how to repaint the parent window? Repainting would be done the same way windows are usually repainted.
Sam Hobbs at 2007-11-11 1:26:17 >
# 2 Re: moving a control in a window
Originally posted by Sam Hobbs
So are you asking how to move a control or how to repaint the parent window? Repainting would be done the same way windows are usually repainted.
Actually, I am asking how to repaint the area of parent window which was originally covered by the control but presently uncovered due to moving control. Actully, the problem is the parent window usually doesn't respond quickly enough for any such area so that the area is not repainted.
dullboy at 2007-11-11 1:27:17 >
# 3 Re: moving a control in a window
When a control is moving over its parent window, Windows is taking care of invalidating proper areas. It will also invoke painting of that windows, when it'll have a chance. If your app is busy doing other things, you may want to call UpdateWindow() yourself (to cause an immediate repaint).
VladimirF at 2007-11-11 1:28:27 >
# 4 Re: moving a control in a window
Originally posted by VladimirF
When a control is moving over its parent window, Windows is taking care of invalidating proper areas. It will also invoke painting of that windows, when it'll have a chance. If your app is busy doing other things, you may want to call UpdateWindow() yourself (to cause an immediate repaint).
UpdateWindow does the trick! Thank you. Actually, I called Invalidate but it didn't work. So what is the difference?
dullboy at 2007-11-11 1:29:21 >
# 5 Re: moving a control in a window
Invalidate() just marks areas of the window as "invalid". Then the WM_PAINT message is placed in the message queue.
UpdateWindow() causes immediate painting of whatever was invalidated.
VladimirF at 2007-11-11 1:30:23 >