Hey Guys,
okay, still learning...,
let's assume I open a single gui window and draw some text on it via WM_PAINT, (which is in my wndproc() function), like below:
Code:
case WM_PAINT:
BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
DrawText(hdc, "Hello World!.", -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &ps);
break;
then, else where, (in another function) I issue a gdi line-draw command like so:
Code:
void DrawLine(HWND hwnd)
{
int x1=50, y1=50, x2=50, y2=150;
HDC myhDC;
myhDC = GetDC(hwnd);
MoveToEx(myhDC, x1, y1, NULL);
LineTo(myhDC, x2, y2);
ReleaseDC(hwnd, myhDC);
}
In the center of my window I have text that reads "Hello World!" and near the upper left corner, I have a 100 pixels long line.
I can drag my window all over the screen and my two objects remain in tact.
However, if I cover my window with another window, only the text remains when I toggle back to my window. The gdi line is no longer displayed.
How would I get windows to redraw the entire contents of the window, including the gdi line I have drawn ?
(without putting the line-draw routine inside of WM_PAINT, that is).