Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

WM_PAINT - why is it being called ad infinitum????

Posted on 2005-05-10
3
Medium Priority
?
416 Views
Last Modified: 2008-02-01
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;
OutputDebugString("CETBWB::OnPaint\n");
return 0;
}




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(HasFocusIO)(void);
            STDMETHOD(TranslateAcceleratorIO)(LPMSG lpMsg);
            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)
      {
      OutputDebugString("CEditQuery::TranslateAcceleratorIO\n");

      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....                  
      }





0
Comment
Question by:esgi
2 Comments
 

Author Comment

by:esgi
ID: 13970534
close
here's answer

LRESULT CMyToolBar::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
      {
      CRect r;
                {compute rect where browser is}
      ValidateRect(r);

      DefWindowProc(uMsg, wParam, lParam);
      return 0;
      }
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 14219539
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question