Repainting a window with a new scene with winapi (beginner question)

Posted by user90760 on Programmers See other posts from Programmers or by user90760
Published on 2013-05-12T01:22:06Z Indexed on 2013/11/09 16:13 UTC
Read the original article Hit count: 155

Filed under:

I'm following theForger's win32 API tutorial in order to create a GUI for a project.

I've successfully made simple, one window applications, but I can't figure out how to repaint an entire window with new information. As an example: I have five buttons corresponding to five colors on the main application window. When a user clicks a color button, the entire window is repainted such that: 1. all five buttons are removed and a new "back" button is replaced, 2. the background is colored the color that was picked.

I'm able to change the background color by trapping the button pressed message in my wndproc, but I can't figure out how to change the entire window with a new "scene" (removing the color buttons and adding a back button).

This seems like a trivial task, but I can't find a solution in tutorials. Do I need to declare a new windows class with the back button and then have my button trap create a window of this class?

© Programmers or respective owner

Related posts about Windows