In regards to the message pump and painting, this is how I do it on my 2d game engine.
// Run the message loop
while(GetMessage(&msg,NULL,0,0))
{
// process messages
TranslateMessage(&msg);
DispatchMessage(&msg);
// always force a redraw for the game loop
if(GetFocus()==hWnd)InvalidateRect(hWnd,NULL,false);
}
As long as the window is active, it gets invalidated, forcing a redraw. When the window goes out of focus, the game engine stops rendering because WM_PAINT messages stop. This is the simplest way to do it.
The other message pump I tried involved PeekMessage() but was much more sophisticated.