Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

IDirectManipulationViewport::SetContact method

Specifies an association between a contact and the viewport.


HRESULT SetContact(
  [in] UINT32 pointerId


pointerId [in]

The ID of the pointer.

Return value

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


Call this method when a WM_POINTERDOWN message is received. Upon receiving a WM_POINTERDOWN, the application can use the coordinates of the input to hit-test and determine the viewports to which the contact is associated.

DeferContact must be called before SetContact.

After initialization, Direct Manipulation is not aware of viewport z-order or parent-child relations between viewports. The order of SetContact calls defines the viewport tree. To establish the correct viewport hierarchy, SetContact should be called first on the child-most viewport, followed by the parent, grand-parent, and so on.

Use GET_POINTERID_WPARAM to get the pointer identifier from a pointer message. The contact is removed automatically when WM_POINTERUP is received.

If a contact is associated with one or more viewports using the SetContact method, Direct Manipulation will examine further input from that contact and attempt to identify an appropriate manipulation based on the configuration of the associated viewports. If a manipulation is recognized, the application will then receive a WM_POINTERCAPTURECHANGED message for this contact. In this context, the WM_POINTERCAPTURECHANGED message indicates that Direct Manipulation has captured the contact and the application will not receive input from this contact that is consumed for this manipulation.


Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]






IID_IDirectManipulationViewport is defined as 28b85a3d-60a0-48bd-9ba1-5ce8d9ea3a6d

See also

User Input Messages and Notifications