Méthode ISpatialInteractionManagerInterop ::GetForWindow (spatialinteractionmanagerinterop.h)
Récupère un objet SpatialInteractionManager lié à l’application active.
Syntaxe
HRESULT GetForWindow(
[in] HWND window,
[in] REFIID riid,
[out] void **spatialInteractionManager
);
Paramètres
[in] window
Type : HWND
Gérez la fenêtre de l’application active.
[in] riid
Type : REFIID
GUID de l’objet SpatialInteractionManager .
[out] spatialInteractionManager
Type : void**
Adresse d’un pointeur vers un objet SpatialInteractionManager .
Valeur retournée
Type : HRESULT
Si cette fonction réussit, elle retourne S_OK. Sinon, elle retourne un code d’erreur HRESULT.
Remarques
Cet exemple montre comment récupérer un SpatialInteractionManager à l’aide de ISpatialInteractionManagerInterop ::GetForWindow pour récupérer le SpatialInteractionManager pour un HWND.
// 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>();
}
Configuration requise
Condition requise | Valeur |
---|---|
Client minimal pris en charge | Windows 10, version 1703 [applications de bureau uniquement] |
Serveur minimal pris en charge | Aucun pris en charge |
Plateforme cible | Windows |
En-tête | spatialinteractionmanagerinterop.h |
Voir aussi
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour