Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft ein SpatialInteractionManager-Objekt ab, das an die aktive Anwendung gebunden ist.
Syntax
HRESULT GetForWindow(
[in] HWND window,
[in] REFIID riid,
[out] void **spatialInteractionManager
);
Parameter
[in] window
Typ: HWND
Handle für das Fenster der aktiven Anwendung.
[in] riid
Typ: REFIID
Die GUID des SpatialInteractionManager-Objekts .
[out] spatialInteractionManager
Typ: void**
Adresse eines Zeigers auf ein SpatialInteractionManager-Objekt .
Rückgabewert
Typ: HRESULT
Wenn diese Funktion erfolgreich ist, wird S_OK zurückgegeben. Andernfalls wird ein Fehlercode HRESULT zurückgegeben.
Hinweise
In diesem Beispiel wird gezeigt, wie Sie einen SpatialInteractionManager mithilfe von ISpatialInteractionManagerInterop::GetForWindow abrufen, um den SpatialInteractionManager für einen HWND abzurufen.
// This code example depends on these headers.
// <SpatialInteractionManagerInterop.h>
// <Windows.UI.Input.Spatial.h>
// <winrt/Windows.UI.Input.Spatial.h>
// Create the window for the HolographicSpace.
hWnd = CreateWindowW(
m_szWindowClass,
m_szTitle,
WS_VISIBLE,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
nullptr,
nullptr,
hInstance,
nullptr);
if (!hWnd)
{
winrt::check_hresult(E_FAIL);
}
{
using namespace winrt::Windows::UI::Input::Spatial;
winrt::com_ptr<ISpatialInteractionManagerInterop> spatialInteractionManagerInterop =
winrt::get_activation_factory<SpatialInteractionManager, ISpatialInteractionManagerInterop>();
winrt::com_ptr<ABI::Windows::UI::Input::Spatial::ISpatialInteractionManager> spSpatialInteractionManager;
winrt::check_hresult(spatialInteractionManagerInterop->GetForWindow(hWnd, __uuidof(ABI::Windows::UI::Input::Spatial::ISpatialInteractionManager), winrt::put_abi(spSpatialInteractionManager)));
SpatialInteractionManager spatialInteractionManager = spSpatialInteractionManager.as<SpatialInteractionManager>();
}
Anforderungen
| Anforderung | Wert |
|---|---|
| Unterstützte Mindestversion (Client) | Windows 10, Version 1703 [nur Desktop-Apps] |
| Unterstützte Mindestversion (Server) | Nicht unterstützt |
| Zielplattform | Windows |
| Kopfzeile | spatialinteractionmanagerinterop.h |