ISpatialInteractionManagerInterop::GetForWindow 메서드(spatialinteractionmanagerinterop.h)

활성 애플리케이션에 바인딩된 SpatialInteractionManager 개체를 검색합니다.

구문

HRESULT GetForWindow(
  [in]  HWND   window,
  [in]  REFIID riid,
  [out] void   **spatialInteractionManager
);

매개 변수

[in] window

형식: HWND

활성 애플리케이션의 창에 대한 핸들입니다.

[in] riid

형식: REFIID

SpatialInteractionManager 개체의 GUID입니다.

[out] spatialInteractionManager

형식: void**

SpatialInteractionManager 개체에 대한 포인터의 주소입니다.

반환 값

형식: HRESULT

이 함수가 성공하면 S_OK 반환합니다. 그러지 않으면 HRESULT 오류 코드를 반환합니다.

설명

이 예제에서는 ISpatialInteractionManagerInterop::GetForWindow를 사용하여 HWND에 대한 SpatialInteractionManager를 검색하여 SpatialInteractionManager를 검색하는 방법을 보여 줍니다.

// 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>();
}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 10, 버전 1703 [데스크톱 앱만 해당]
지원되는 최소 서버 지원되는 버전 없음
대상 플랫폼 Windows
헤더 spatialinteractionmanagerinterop.h

추가 정보