WM_PAINT - why is it being called ad infinitum????
Posted on 2005-05-10
I have an ATL based toolbar...
I also have a composite control with a web browser in it...
I manual create it using the window handle of the toolbar....
HWND hWnd2 = wnd2.Create(m_hWnd, rc3, _T("MYLIB.MY_COMPOSITE_WEB_CONTROL"), WS_CHILD | WS_VISIBLE);
OK, it shows up on toolbar fine, but the thing is, I added a OnPaint handler
(note I do not NEED the OnPaint handler, I added it because of problem)
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
bHandled = TRUE;
And found that it was called ad infinitum....
(The reason I added OnPaint handler was because the control with embedded webbrowser was not updating properly)
Now this continual OnPaint call is NOT the kind you get from debugging (ie you break, the window has to be re-painted...you hit break point again...yada...yada..)
Also I do not call invalidate on window rect of anybody...so why is the OnPaint being called repeatedly???
(related to problem...)
I also have an edit box on the toolbar (also, of course, created manually)
Basically, when I enter text in text box, the browser goes "blank" and doesn't get redrawn (the browser embedded in toolbar)
To "fix" problem with edit box not receiving back space key press messages, one has to implement some ugly stuff..ie...
STDMETHOD(UIActivateIO)(BOOL fActivate, LPMSG lpMsg);
(this is because ie steals the key press message for special keys.....)
I found that if I commented out the TranslateAcceleratorIO code...the browser problem disappeared....but I need to capture backspace keys.....
void CEditQuery::TranslateAcceleratorIO(LPMSG lpMsg)
int nVirtKey = (int)(lpMsg->wParam);
if (VK_RETURN == nVirtKey)
// remove system beep on enter key by setting key code to 0
lpMsg->wParam = 0;
::PostMessage(::GetParent(GetParent()), OCM_COMMAND, MAKEWPARAM(idSearch, 0), 0L); }
TranslateMessage(lpMsg); <<----- if I comment these two lines...browser problem disappears... :-(
DispatchMessage(lpMsg); <-------- now I can' t deal with backspaces though....