hey hey... just started windows programming today... looked through some tutorials but alittle lost... wondering if someone can help me with a simple question
i have a background color in my window but when i resize it the background color is lost... not quite sure how i would keep the background color..
Do I need to use a PaintStruct? (i don't even know what it is )
LRESULT CALLBACK WndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
static int counter = 0;
switch (iMsg)
{
case WM_LBUTTONDOWN:
HBRUSH hbrush;
HDC hdc;
RECT client_window;
hdc = GetDC(hwnd);
GetClientRect(hwnd,&client_window);
counter = counter + 1;
if (counter == 1)
{
hbrush = CreateSolidBrush(RGB(255, 64, 43));
FillRect(hdc,&client_window,hbrush);
}
else if (counter == 2)
{
hbrush = CreateSolidBrush(RGB(89, 65, 0));
FillRect(hdc,&client_window,hbrush);
}
else if (counter == 3)
{
hbrush = CreateSolidBrush(RGB(55, 0, 56));
FillRect(hdc,&client_window,hbrush);
}
else
{
PostQuitMessage(0);
}
ReleaseDC(hwnd,hdc);
DeleteObject(hbrush);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc (hwnd, iMsg, wParam, lParam);
}
I know i need "case WM_PAINT:" in there but i'm not sure what to put after that. Do i need "case WM_SIZE:" ?
also did i free memory properly or am i missin' something?
thnx in advance for any kind of help