I am new to this and am teaching myself. I have been searching the internet but cannot find a reference to what I am trying to do. I have learned how to create a window, buttons, and menu for a win32 app so far. I wanted to write a program that would give someone a test. So my problem is now how do I keep a single window with radio buttons that changes each time the user enters an answer. Thank you for your help.
Will
p.s. I am just looking for a command that will clear the screen and maybe some advice on how to repopulate it thank you.
What do you mean by "clearing a window"? If you add a STATIC control to the dialog window, then you can use SetWindowText() to modify the text displayed in it at will. You would set it to "" to clear it.
#include <windows.h>
void ClearScreen()
{
HANDLE hStdOut;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD count;
DWORD cellCount;
COORD homeCoords = { 0, 0 };
hStdOut = GetStdHandle( STD_OUTPUT_HANDLE );
if (hStdOut == INVALID_HANDLE_VALUE) return;
/* Get the number of cells in the current buffer */
if (!GetConsoleScreenBufferInfo( hStdOut, &csbi )) return;
cellCount = csbi.dwSize.X *csbi.dwSize.Y;
/* Fill the entire buffer with spaces */
if (!FillConsoleOutputCharacter(
hStdOut,
(TCHAR) ' ',
cellCount,
homeCoords,
&count
)) return;
/* Fill the entire buffer with the current colors and attributes */
if (!FillConsoleOutputAttribute(
hStdOut,
csbi.wAttributes,
cellCount,
homeCoords,
&count
)) return;
/* Move the cursor home */
SetConsoleCursorPosition( hStdOut, homeCoords );
}
int main()
{
ClearScreen();
return 0;
}
@forloopfreak
GUI windows aren't typically meant to be "cleared" and repopulated. Repaint issues are specific to the GUI system you are working with -- with Win32 most standard controls know how to paint themselves, so you only need to do special painting when you handle your window's WM_PAINT event.
What exactly are you trying to accomplish with this?
If you build a QtWidget Based Application things are pretty much done for you. You just need to drag and drop the radio-buttons on text windows to where you want them to be. It's an easy way of getting a descent GUI.