
Advice on "return-when-finished" function call
If the intervals are short and the whole animation plays out quickly,
just use Sleep for delays. Otherwise, you can spin a modal message pump
based on PeekMessage to keep UI responsive, but beware reentrancy.
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
Quote:
> Hey everyone,
> I wrote a very simple class that takes a
> bitmap "strip" and animates it frame by frame onto the
> provided device context with a speed that the caller can
> specify.
> My function is: AnimateBlt (HDC, int x, int y, ...)
> How would I write it so that the function itself will
> not return until the animation cycle is complete?
> Right now, the function sets a timer, and on each tick
> of the timer, the frame is incremented and updated onto
> the screen. It works well and the animation looks real.
> Problem is, after the animation is complete,
> the "permanent" image (not part of the strip) must be
> rendered overtop the last frame of the animation, and as
> it stands now- it does but is never seen because my
> function returns prior to the last frame being rendered.
> How can I do this?
> TIA- Stiffler