IDirectManipulationManager::RegisterHitTestTarget method

Registers a dedicated thread for hit testing.


HRESULT RegisterHitTestTarget(
  [in]           HWND                            window,
  [in, optional] HWND                            hitTestWindow,


window [in]

The handle of the main app window (typically created from the UI thread).

hitTestWindow [in, optional]

The handle of the window in which hit testing is registered (should be created from the hit testing thread). Pass in nullptr to unregister a previously registered hit-test target.

type [in]

One of the values from DIRECTMANIPULATION_HITTEST_TYPE. Specifies whether the UI window or the hit testing window (or both) receives the hit testing WM_POINTERDOWN message , and in what order.

Return value

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


Hit testing is typically performed on the application UI thread. The application receives a WM_POINTERDOWN message on which hit-testing is performed. If a manipulation is required, SetContact is called on one or more viewports. An application can use the RegisterHitTestTarget method to delegate this hit-testing responsibility to a separate hit-testing thread.

Once a dedicated hit-test target is successfully registered, WM_POINTERDOWN messages are processed on the hit-testing thread. If a manipulation, such as pan or zoom, is required, SetContact is called from this thread.

If SetContact is not called from the hit-testing thread, WM_POINTERDOWN messages may be processed on the UI thread, depending on the DIRECTMANIPULATION_HITTEST_TYPE specified during registration.

If SetContact is not called by either the hit-test thread or the UI thread, Direct Manipulation ignores the input which is then handled on the UI thread.


Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]






IID_IDirectManipulationManager is defined as FBF5D3B4-70C7-4163-9322-5A6F660D6FBC

See also