Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


redrawing window without WM_PAINT (manually)?

This topic is 5531 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post

Link to post
Share on other sites
So, why not just do it in the main game loop? Some pseudo-code:

if PeekMessage()
Translate and Dispatch Messages()
//and then either

GameLoop() <---do it in this function
// OR

FillRect(), etc. <-----do it all in the loop right here

[edited by - andromeda on May 28, 2003 9:17:42 PM]

Share this post

Link to post
Share on other sites
You need to call InvalidateRect();
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]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!