Win32Interop.GetWindowIdFromWindow(IntPtr) method

February 12, 2026 ยท View on GitHub

Reference

Definition

Namespace: Microsoft.UI

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

public static WindowId GetWindowIdFromWindow(IntPtr hwnd);

Parameters

hwnd IntPtr

The handle of the window for which to get the WindowId.

Returns

WindowId

The identifier that corresponds to the specified hwnd, if the provided hwnd is valid. Otherwise, null.

Applies to

ProductIntroduced in
WinUIWindows App SDK 1.0

See also