IDirectManipulationViewport::AddEventHandler 方法 (directmanipulation.h)

添加新事件处理程序以侦听视区事件。

语法

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

参数

[in] window

线程拥有的事件回调窗口的句柄。

[in] eventHandler

发生视区状态和更新事件时调用的处理程序。 指定的对象必须实现 IDirectManipulationViewportEventHandler 接口。

[out, retval] cookie

表示此事件处理程序回调的句柄。

返回值

如果该方法成功,则返回 S_OK。 否则,将返回 HRESULT 错误代码。

备注

事件回调是从拥有指定窗口的线程触发的。 可以合并同一回调方法的连续事件。

注意 如果视区附加了拖放行为,则事件处理程序应实现 IDirectManipulationDragDropEventHandler
 

要求

   
最低受支持的客户端 Windows 8 [仅限桌面应用]
最低受支持的服务器 Windows Server 2012 [仅限桌面应用]
目标平台 Windows
标头 directmanipulation.h

另请参阅

IDirectManipulationViewport