Original Post
Hi,
i want to know whats the best structure for message loops within your WinMain?
Ive got this:
PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)
while(msg.message != WM_QUIT)
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
else
{
// Nothing todo so do the drawing stuff now
}
}
which is quite nice and simple - but it still uses 100% CPU processing, i know this is because of the loop, the only way to get away from that would be to use GetMessage, but i dont want that because it hangs until a message is ready for dispatch.
(I presume also thats why it doesnt properly change your mouse cursor when you come from outside a window and then hover over the inside? ie, if you can stretch the sides of your window with that kind of loop, when you bring the mouse across the side and into the main window, it wont change the mouse properly)
Any light you can shed onto this area will be greatly received