Compartilhar via


CWnd::OnMouseActivate

The framework calls this member function when the cursor is in an inactive window and the user presses a mouse button.

afx_msg int OnMouseActivate( 
   CWnd* pDesktopWnd, 
   UINT nHitTest, 
   UINT message  
);

Parameters

  • pDesktopWnd
    Specifies a pointer to the top-level parent window of the window being activated. The pointer may be temporary and should not be stored.

  • nHitTest
    Specifies the hit-test area code. A hit test is a test that determines the location of the cursor.

  • message
    Specifies the mouse message number.

Return Value

Specifies whether to activate the CWnd and whether to discard the mouse event. It must be one of the following values:

  • MA_ACTIVATE   Activate CWnd object.

  • MA_NOACTIVATE   Do not activate CWnd object.

  • MA_ACTIVATEANDEAT   Activate CWnd object and discard the mouse event.

  • MA_NOACTIVATEANDEAT   Do not activate CWnd object and discard the mouse event.

Remarks

The default implementation passes this message to the parent window before any processing occurs. If the parent window returns TRUE, processing is halted.

For a description of the individual hit-test area codes, see the OnNcHitTest member function

Note

This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.

Example

// The code fragment below shows how to UI activate an ActiveX control. 
// CMyAxCtrl is a COleControl-derived class. 
int CMyAxCtrl::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
   OnActivateInPlace(TRUE, NULL);  // OnActivateInPlace() is an undocumented function 
   return COleControl::OnMouseActivate(pDesktopWnd, nHitTest, message);
}

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::OnNcHitTest

CWnd::OnMouseActivate