Lets say i want to create a window using only Win32 and no opengl or directdraw that shows a constant animation. I don't want to tie up window resources so i want to return to the message loop as soon as possible. I don't want to use a timer. Is there any message that is continually sent to the message que for my window that i can respond to, do a bit of animation, and then return control to windows. WM_PAINT wont work because its only sent if something needs updating. Any help appreciated.

Still struggling
Thanx
Posted on 2001-08-04 17:06:21 by titan
There are a couple of methods I've come across. The simplest is to include an InvalidateRect call inside your message translating loop and then to all your drawing normaly in the WM_PAINT messages. I notice Serge Coban uses this in his examples.

Another is call your drawing routines inside the WM_PAINT message but never use BeginPaint or EndPaint. I think you also have to return 0. I don't know if this is good programming practice but it works.

The final method I'm aware of is to place all your drawing commands inside a procedure and call this from the message translating loop. This is the method I tend to use.

One thing, you may already be doing this but just in case, it's recommended that you use the OWNDC style (maybe ExStyle) in the window class if you're doing animation like this.

Also a last final note, I've never noticed any difference in frame rates regardless of which method I used so if someone knows which is the best programming practice then thats probably the one to use.
Posted on 2001-08-04 17:59:01 by Eóin