redrawing window without WM_PAINT (manually)?

Started by
2 comments, last by billybob 20 years, 10 months ago
my window will change and needs to be redrawn not necessarily on a WM_PAINT message. however, it doesn''t seem to be able to draw except during a WM_PAINT message. it is a dialog window, i''ve tried SendMessage(hWnd, WM_PAINT, ..., ...) with lots of things for ..., ... like GetDC(hWnd), and various PAINTSTRUCT things. how?
Advertisement
So, why not just do it in the main game loop? Some pseudo-code:

    while(1){if PeekMessage(){Translate and Dispatch Messages()}//and then eitherGameLoop() <---do it in this function// ORFillRect(), etc. <-----do it all in the loop right here}    


[edited by - andromeda on May 28, 2003 9:17:42 PM]
You need to call InvalidateRect();
quote:From MSDN
The InvalidateRect function adds a rectangle to the specified window's update region. The update region represents the portion of the window's client area that must be redrawn.

BOOL InvalidateRect(
HWND hWnd, // handle to window
CONST RECT* lpRect, // rectangle coordinates
BOOL bErase // erase state
);


EDIT: You're allowed to pass NULL as the second parameter if you want to update the entire window.

John B

[edited by - JohnBSmall on May 28, 2003 9:22:47 PM]
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
its not a game, its a windows only edit thing. thanks JohnB

This topic is closed to new replies.

Advertisement