1
votes

(My English can be strange o_o)

I work with MFC tabbed MDI, No Document/View

I delete auto-generated View Class, and use CSplitterWnd and my own View Class

"my own View Class" has two child: edit control and my custom control

(edit: I created new tabbed MDI, No Document/View MFC Project and tested that project by spy++. and the following problem occur AGAIN!)
(edit: Use Document/View: AGAIN!)

While I write this program, I found a strange problem:

When I validate window by clicking Aero Peek Thumbnail, my custom control is drawn so many times (WM_PAINT is sent many times)

I figured out CMDIFrameWndEx::OnAfterTaskbarActivate function calls RedrawWindow in that WM_PAINT, and OnAfterTaskbarActivate is callen so many times (31 times, yah)

Could you tell me what makes this problem and how to solve?

1

1 Answers

1
votes

I had the same issue as this. My Solution is to override the OnAfterTaskbarActivate

add this to your MessageMap

ON_REGISTERED_MESSAGE(AFX_WM_AFTER_TASKBAR_ACTIVATE, OnAfterTaskbarActivate)

the function is as follows. please note this is exactly the same as the original function without the redraw.

LRESULT CMainFrame::OnAfterTaskbarActivate(WPARAM, LPARAM lp)
    {
    HWND hwndMDIChild = (HWND)lp;
    if (hwndMDIChild != NULL && ::IsWindow(hwndMDIChild))
        {
        ::SetFocus(hwndMDIChild);
        }
    return 0;
    }

I hope this helps. it has resolved my issues.