NetAutoGUI.Windows/UIElement.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using Vanara.PInvoke;
using static Vanara.PInvoke.User32;
namespace NetAutoGUI.Windows;
public class UIElement
{
private HWND hwnd;
public UIElement(long hwnd)
{
this.hwnd = hwnd.ToHWND();
}
public UIElement(HWND hwnd)
{
this.hwnd = hwnd;
}
public HWND Handle
{
get
{
return this.hwnd;
}
}
public string ClassName
{
get
{
int len = 256;
StringBuilder sbClass = new StringBuilder(len);
User32.RealGetWindowClass(hwnd, sbClass, (uint)len);
return sbClass.ToString();
}
}
public string Text
{
get
{
int txtLen = User32.GetWindowTextLength(hwnd);
StringBuilder sbText = new StringBuilder(txtLen);
User32.GetWindowText(hwnd, sbText, txtLen + 1);
return sbText.ToString();
}
set
{
User32.SetWindowText(hwnd, value);
}
}
public UIElement? Parent
{
get
{
var pHwnd = User32.GetParent(hwnd);
if (pHwnd.IsNull)
后面还有 155 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。