| title | Win32Interop.GetWindowIdFromWindow(IntPtr) method |
|---|---|
| description | Gets the `WindowId` that corresponds to the specified _hwnd_, if the provided `HWND` is a valid. |
| ms.topic | article |
| ms.date | 02/08/2022 |
| keywords | windows 10, windows 11, Windows App SDK, desktop development, winui, app sdk, C#, interop, Win32Interop.GetDisplayIdFromMonitor, GetDisplayIdFromMonitor |
| ms.localizationpriority | low |
Reference
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);hwnd IntPtr
The handle of the window for which to get the WindowId.
The identifier that corresponds to the specified hwnd, if the provided hwnd is valid. Otherwise, null.
| Product | Introduced in |
|---|---|
| WinUI | Windows App SDK 1.0 |