IDirectManipulationViewport::AddEventHandler method (directmanipulation.h)

Adds a new event handler to listen for viewport events.

Syntax

HRESULT AddEventHandler(
  [in]          HWND                                    window,
  [in]          IDirectManipulationViewportEventHandler *eventHandler,
  [out, retval] DWORD                                   *cookie
);

Parameters

[in] window

The handle of a window owned by the thread for the event callback.

[in] eventHandler

The handler that is called when viewport status and update events occur. The specified object must implement the IDirectManipulationViewportEventHandler interface.

[out, retval] cookie

The handle that represents this event handler callback.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The event callback is fired from the thread that owns the specified window. Consecutive events of the same callback method may be coalesced.

Note  If the viewport has a drag-drop behavior attached, the event handler should implement IDirectManipulationDragDropEventHandler.
 

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps only]
Minimum supported server Windows Server 2012 [desktop apps only]
Target Platform Windows
Header directmanipulation.h

See also

IDirectManipulationViewport