Hi,
I've been wondering ever since I started programming - how does windows redraw windows? Like when you drag a window across the screen, how does it redraw the stuff that's 'behind' that window?
Hi,
I've been wondering ever since I started programming - how does windows redraw windows? Like when you drag a window across the screen, how does it redraw the stuff that's 'behind' that window?
look in to wm_paint and the message que
edit
also look up dib.
Essentially, the "behind" windows are notified by Windows that some portion of it has been invalidated (the portion that has become "uncovered" as a result of the foreground window moving to reveal it), then the "behind" window repaints itself so it doesn't appear blank where the foreground window moved from. A perfect example of this is when an app stops responding and you drag other apps across it; it is hanging and, thus, no longer responding to messages and the dragged over parts just turn white.
How the screen 'looks' is contained in a BMP.
A Device Context (DC) contains the BMP and the other current Graphical Device Interface objects (GDI) used. (pen, brush and font ect)
Your app (or the OS) sends a paint msg to the window that needs repainting. It does this by 'invaldating' the area (usually a rectangle).
In the paint handler (WM_PAINT) you call BeginPaint().
BeginPaint() gets the section of the DC for the current window that is invalid (needs painting) and redaws it based on the window class (background colour, font ect) or your code (image you have stored in a seperate DC). The BeginPaint() sets the area to valid again.
EndPaint() cleans up the GDI reources.
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill
hmmm...that's pretty interesting how they do all that. I'll look into those links you posted, Lucky.
What kind of data structures in memory are the graphics for windows stored in?
>>What kind of data structures in memory are the graphics for windows stored in?
Device Contexts
"Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
Friedrich Nietzsche
"I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
George Best
"If you are going through hell....keep going."
Winston Churchill