Discussion:
destroy current window,then draw something else?
(too old to reply)
vijk
2011-03-15 19:48:24 UTC
Permalink
I'm trying to do something like the following but need ideas/examples:-
I have an application;Upon recieving a magic keystroke or an option
pressed,the entire window & contents to be destroyed,and a new one
drawn that will have a completely different appearance,possibly.No
spawning or changing processes etc.Anyone have ideas on this or tried
this/howto?thanks
steve
2011-03-16 17:34:16 UTC
Permalink
Post by vijk
I'm trying to do something like the following but need ideas/examples:-
I have an application;Upon recieving a magic keystroke or an option
pressed,the entire window & contents to be destroyed,and a new one
drawn that will have a completely different appearance,possibly.No
spawning or changing processes etc.Anyone have ideas on this or tried
this/howto?thanks
The easiest thing would be to clear the display.

{
RECT rect;
HWND hwnd;
COLORREF Bcolor;

HDC hDC = GetDC(hwnd);


Bcolor = GetBkColor(hDC); /* get the current background color
*/
SetDCBrushColor(hDC, Bcolor);
/* clear screen */
FillRect(hDC, rect, (HBRUSH) GetStockObject(DC_BRUSH));

InvalidateRect(hwnd, &rect, FALSE);
UpdateWindow(hwnd);
ReleaseDC(hwnd, hDC);

}

This code was not compiled.
This only illustrates basic principle of clearing the screen.

Continue reading on narkive:
Loading...