Win32 HDC issue
someone
20
Reputation points
I have a problem with drawing HDC outside WM_PAINT message, I draw in function with while(true) loop
void quadcycle()
{
while(true)
{
hdc = GetDC(hwnd);
RECT rc = {50,50,150,150};
FillRect(hdc, &rc, (HBRUSH)CreateSolidBrush(RGB(255,0,std::time(NULL)*2 % 255 ))) );
ReleaseDC(hwnd,hdc);
}
}
To make the square change color with time, but instead of changing color I saw my square disappear :(
I checked all the places and realized that it is because of this loop, but I just slow down the loop to make it disappear a little later.
Please help, I am new to win32 development.
Sign in to answer