Skip to content

winrt.microsoft.ui.interop module

Exposes interop functions from the Microsoft.UI.Interop namespace.

See: https://learn.microsoft.com/en-us/windows/windows-app-sdk/api/win32/winrt-microsoft.ui.interop/

get_window_id_from_window

get_window_id_from_window(hwnd: int, /) -> winrt.microsoft.ui.WindowId

Gets the WindowId that corresponds to the specified hwnd, if the provided HWND is valid.

Parameter Type Description
hwnd int The handle of the window for which to get the WindowId.

Returns: The identifier that corresponds to the specified hwnd.

Raises: OSError – if the OS call failed.

Added in version 2.1

get_window_from_window_id

get_window_from_window_id(window_id: winrt.microsoft.ui.WindowId, /) -> int

Gets the window handle that corresponds to the specified window_id, if the provided window_id is valid and the system has an HWND that represents the window.

Parameter Type Description
window_id winrt.microsoft.ui.WindowId The identifier for the window for which to get the HWND.

Returns: The handle of the window that corresponds to the specified window_id.

Raises: OSError – if the OS call failed.

Added in version 2.1

get_display_id_from_monitor

get_display_id_from_monitor(hmonitor: int, /) -> winrt.microsoft.ui.DisplayId

Gets the DisplayId that corresponds to the specified hmonitor, if the provided HMONITOR is valid.

Parameter Type Description
hmonitor int The handle of the display monitor for which to get the DisplayId.

Returns: The identifier that corresponds to the specified hmonitor.

Raises: OSError – if the OS call failed.

Added in version 2.1

get_monitor_from_display_id

get_monitor_from_display_id(display_id: winrt.microsoft.ui.DisplayId, /) -> int

Gets the display monitor handle that corresponds to the specified display_id, if the provided display_id is valid and the system has an HMONITOR that represents the display monitor.

Parameter Type Description
display_id winrt.microsoft.ui.DisplayId The identifier for the display monitor for which to get the HMONITOR.

Returns: The handle of the display monitor that corresponds to the specified display_id.

Raises: OSError – if the OS call failed.

Added in version 2.1

get_icon_id_from_icon

get_icon_id_from_icon(hicon: int, /) -> winrt.microsoft.ui.IconId

Gets the IconId that corresponds to the specified hicon, if the provided HICON is valid.

Parameter Type Description
hicon int The handle of the icon for which to get the IconId.

Returns: The identifier that corresponds to the specified hicon.

Raises: OSError – if the OS call failed.

Added in version 2.1

get_icon_from_icon_id

get_icon_from_icon_id(icon_id: winrt.microsoft.ui.IconId, /) -> int

Gets the icon handle that corresponds to the specified icon_id, if the provided icon_id is valid and the system has an HICON that represents the icon.

Parameter Type Description
icon_id winrt.microsoft.ui.IconId The identifier for the icon for which to get the HICON.

Returns: The handle of the icon that corresponds to the specified icon_id.

Raises: OSError – if the OS call failed.

Added in version 2.1