
ASSERT in WM_MOUSEACTIVATE
Tjena Ruben!
Comments inline
Quote:
> Hej Johan,
> I have gone over the CView source but I don't quite understand it, here it
is:
Quote:
> int CView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
> {
> int nResult = CWnd::OnMouseActivate(pDesktopWnd, nHitTest, message);
> if (nResult == MA_NOACTIVATE || nResult == MA_NOACTIVATEANDEAT)
> return nResult; // frame does not want to activate
> CFrameWnd* pParentFrame = GetParentFrame();
> if (pParentFrame != NULL)
> {
> // eat it if this will cause activation
> ASSERT(pParentFrame == pDesktopWnd ||
pDesktopWnd->IsChild(pParentFrame));
Here the code will assert if the view parent is not the desktop or the
parent is not a top-level window. In this case, you must have created a view
with a non-toplevel frame as a parent?
<snip>
Quote:
> I could probably avoid this by doing the check in my form view and if the
expression in
> the ASSERT would return false just skip the call to the parent class and
return an
> appropriate value. The problem with this is that I don't understand why I
have to do
> this, I mean how many other places do I have to do a similar test? I
thought the
> WM_MOUSEACTIVATE should only go to the window under the mouse pointer
> (which isn't my window), which probably is the main problem here.
The problem seems to be the parent-relation for CViews - are you perhaps
hosting a CView in a non-CFrameWnd derived class?
Quote:
> I don't get the ASSERT if I click in another window when my app is active
(and I don't > get a WM_MOUSEACTIVATE). It's only if I spin the mouse wheel
over another
Quote:
> window or even the desktop itself.
The reason for *not* getting assertions is obviously that the other windows
don't derive from CView :-) But I am a bit surprised, do the ASSERT trigger
in your CView when you use the mouse wheel over windows outside your own
app? Are you perhaps capturing the mouse in your view, or something like
that?
Quote:
> Also, why doesn't the de{*filter*} start when I hit Retry?
This also leads me to suspecting you are doing something fundamentally...
bad? In your place, I would have made a minimum project - that is an empty
app with the same basic structure for the frame and view(s), and then
checked if there was a problem with this basic setting. If not, you have
some fishy proceedings in your code, try to copy suspect code to the test
project. Suspect code in this case would be mouse captures, hooks and the
like.
Quote:
> So many questions....
Med ett schysst j?rnr?r sl?r man v?rlden med h?pnad :-)
Quote:
> Ruben
<snip>
Johan Rosengren
Responsable Informatique
PACTA S.A.