Share via


interop::GetMonitorFromDisplayId 函式 (microsoft.ui.interop.h)

如果 displayId 自變數有效且系統具有代表顯示監視器的 HMONITOR,則取得對應至指定 DisplayIdHMONITOR

注意

標頭microsoft.ui.interop.h相依於 ,此相依性microsoft.ui.h不會作為 Windows 應用程式 SDK 的一部分出貨。 您可以在 上Microsoft.UI.idl執行 MIDL 編譯程式 (midl.exe) ,以產生 microsoft.ui.h。 或者,請改用 winrt/Microsoft.ui.interop.h 標頭中的函式。

C#。 針對 C# 傳統型應用程式開發人員,此標頭中的 Interop 函式會由 Microsoft.UI.Win32Interop 類別的方法包裝。

語法

HRESULT GetMonitorFromDisplayId(
  ::ABI::Microsoft::UI::DisplayId displayId,
  HMONITOR                        *hmonitor
) noexcept;

參數

displayId

類型: DisplayId

顯示的識別碼。

hmonitor

類型: HMONITOR

如果 displayId 有效且系統具有代表顯示監視器的 HMONITOR,則與 displayId 對應的顯示監視器句柄。 否則為 null

傳回值

類型: HRESULT

如果函式成功,則傳回 S_OK 。 否則,傳回指出錯誤的值。

規格需求

需求
最低支援的用戶端 Windows 10 版本 1809 (Windows 應用程式 SDK 1.0 或更新版本)
標頭 microsoft.ui.interop.h

另請參閱

管理應用程式視窗