NetAutoGUI.Windows/WindowExtensions.cs
(完整代码) 1KBusing NetAutoGUI.Windows;
using System;
using System.Threading;
using Vanara.PInvoke;
namespace NetAutoGUI
{
public static class WindowExtensions
{
public static void Activate(this Window window)
{
ActiveWindow(window.Id);
Thread.Sleep(100);
}
public static void ActiveWindow(long windowId)
{
//https://stackoverflow.com/questions/2636721/bring-another-processes-window-to-foreground-when-it-has-showintaskbar-false
HWND hwnd = new HWND((IntPtr)windowId);
if (User32.IsIconic(hwnd))
{
User32.ShowWindow(hwnd, ShowWindowCommand.SW_RESTORE);
}
User32.SetForegroundWindow(hwnd);
}
public static void Maximize(this Window window)
{
HWND hwnd = new HWND((IntPtr)window.Id);
User32.ShowWindow(hwnd, ShowWindowCommand.SW_MAXIMIZE);
Thread.Sleep(100);
}
public static dynamic GetMainMenu(this Window window)
{
HWND hwnd = new HWND((IntPtr)window.Id);
return new DynamicMainMenu(hwnd);
}
public static UIElement GetRoot(this Window window)
{
return new UIElement(window.Id);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。