Ghost1372

everything can be handy

WindowHelper

SwitchToThisWindow

1
2
3
4
5
6
WindowHelper.SwitchToThisWindow(window);

or

WindowHelper.SwitchToThisWindow(hwnd);

ReActivateWindow

1
2
3
4
5
6
WindowHelper.ReActivateWindow(window);

or

WindowHelper.ReActivateWindow(hwnd);

CreateWindowWithFrame

1
2
3
4
var windowWithFrame = WindowHelper.CreateWindowWithFrame();

//windowWithFrame.rootFrame
//windowWithFrame.window

SetWindowCornerRadius

1
2
3
4
5
6
WindowHelper.SetWindowCornerRadius(window, NativeValues.DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND);

or

WindowHelper.SetWindowCornerRadius(hwnd, NativeValues.DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND);

GetTopLevelWindows

1
var topWindows = WindowHelper.GetTopLevelWindows();

GetProcessWindowList

1
var processWindowList = WindowHelper.GetProcessWindowList();

GetWindowText

1
var windowText = WindowHelper.GetWindowText(hwnd);

GetClassName

1
var windowClassName = WindowHelper.GetClassName(hwnd);

GetCurrentAppWindow

1
var appWindow = WindowHelper.GetCurrentAppWindow();

GetAppWindow / GetAppWindow2

1
2
3
4
5
6
7
8
9

// Use XamlRoot
var appWindow = WindowHelper.GetAppWindow(element);

or

// Use Microsoft.UI.Composition.Visual
var appWindow = WindowHelper.GetAppWindow2(element);

GetWindowHandle / GetWindowHandle2

1
2
3
4
5
6
7
8
9

// Use XamlRoot
var hwnd = WindowHelper.GetWindowHandle(element);

or

// Use Microsoft.UI.Composition.Visual
var hwnd = WindowHelper.GetWindowHandle2(element);

Demo

you can run demo and see this feature.

0%