[RESOLVED] flick when subclassing Edit control
Hi all,
could you please help me to remove flick when i subclass an Edit control, this my code:
Code:
LRESULT CALLBACK WindowProcedureEdit(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT lpRect;
HDC hDC;
HBRUSH hBrush,oBrush;
if(message == WM_PAINT)
{
GetClientRect(hwnd, &lpRect);
hBrush = CreateSolidBrush(RGB(255,255,255));
oBrush = CreateSolidBrush(RGB(250,0,0));
hDC = GetDC(hwnd);
FillRect(hDC,&lpRect,hBrush);
FrameRect(hDC,&lpRect,oBrush);
ReleaseDC(hwnd, hDC);
DeleteObject(hBrush);
DeleteObject(oBrush);
return 0L;
}
if(message == WM_ERASEBKGND)
{
return 1L;
}
return CallWindowProc(g_oldEditProc, hwnd, message, wParam, lParam);
}
Re: flick when subclassing Edit control
In respond to WM_PAINT message you have to use BeginPaint/EndPaint functions, not GetDC/ReleaseDC
Please, read MSDN articles:
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx