IOleInPlaceObjectWindowless::OnWindowMessage

Dispatches a message from a container to a windowless object that is in-place active.

HRESULT OnWindowMessage(

    UINT msg,

//Message Identifier as provided by Windows

    WPARAM wParam,

//Message parameter as provided by Windows

    LPARAM lParam,

//Message parameter as provided by Windows

    LRESULT* plResult

//Pointer to message result code

   );

 

 

Parameters

msg

[in] Identifier for the window message provided to the container by Windows.

wParam

[in] Parameter for the window message provided to the container by Windows.

lParam

[in] Parameter for the window message provided to the container by Windows.

plResult

[out] Pointer to result code for the window message as defined in the Windows API.

 

Return Values

S_OK

The window message was successfully dispatched to the windowless object.

S_FALSE

The windowless object did not process the window message. The container should call the DefWindowProc for the message or process the message itself as described below.

 

Remarks

A container calls this method to send window messages to a windowless object that is in-place active. The container should dispatch messages according to the following guidelines:

    For the following messages, the container should first dispatch the message to the windowless object that has captured the mouse, if any. Otherwise, the container should dispatch the message to the windowless object under the mouse cursor. If there is no such object, the container is free to process the message for itself.

WM_MOUSEMOVE

 

WM_SETCURSOR

 

WM_XBUTTONDOWN

 

WM_XBUTTONUP

 

WM_XBUTTONDBLCLK

 

 

    For the following messages, the container should dispatch the message to the windowless object with the keyboard focus.

WM_KEYDOWN

WM_SYSKEYUP

WM_KEYUP

WM_SYSDEADCHAR

WM_CHAR

WM_IMExxx

WM_DEADCHAR

WM_HELP

WM_SYSKEYDOWN

WM_CANCELMODE

 

    For all other messages, the container should process the message on its own.

 

The windowless object can return S_FALSE to this method to indicate that it did not process the message. Then, the container either performs the default behavior for the message by calling the Windows API function DefWindowProc, or processes the message itself.

The container must pass the following window messages to the default window procedure:

WM_MOUSEMOVE

WM_DEADCHAR

WM_XBUTTONxxx

WM_SYSKEYUP

WM_KEYDOWN

WM_SYSCHAR

WM_KEYUP

WM_SYSDEADCHAR

WM_CHAR

WM_IMExxx

 

The container must process the following window messages as its own:

WM_SETCURSOR

 

WM_CONTEXTMENU

 

WM_HELP

 

 

 

Note  For WM_SETCURSOR, the container can either set the cursor itself or do nothing.

 

Objects can also use IOleInPlaceSiteWindowless::OnDefWindowMessage to explicitly invoke the default message processing from the container. In the case of the WM_SETCURSOR message, this allows an object to take action if the container does not set the cursor.

All coordinates passed to the object in wParam and lParam are specified as client coordinates of the containing window.

See Also

IOleInPlaceSiteWindowless::SetCapture, IOleInPlaceSiteWindowless::OnDefWindowMessage