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 を使用して SPATIALInteractionManager を取得し、HWNDSpatialInteractionManager を取得する方法を示します。

// 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

こちらもご覧ください