docs: 电脑操作模式进度存档(暂停待续)+ 调试脚本

- docs/computer-use-PROGRESS.md: 已完成/已知问题/关键机制踩坑记录
- tools/test-enum.ps1: EnumWindows 基准脚本(本机验证可用)
- PLAN.md 更新:阶段3进行中,因余额暂停
This commit is contained in:
江晨
2026-08-17 12:10:32 +08:00
parent c33fe31f49
commit 3e364d576d
3 changed files with 72 additions and 7 deletions
+28
View File
@@ -0,0 +1,28 @@
Add-Type -TypeDefinition @'
using System;using System.Runtime.InteropServices;using System.Text;
public class W {
[DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr l);
[DllImport("user32.dll")] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n);
[DllImport("user32.dll")] public static extern int GetWindowTextLength(IntPtr h);
[DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
public delegate bool EnumProc(IntPtr h, IntPtr l);
[StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left,Top,Right,Bottom; }
}
'@
$list = New-Object System.Collections.ArrayList
$cb = [W+EnumProc]{ param($h,$l)
if ([W]::IsWindowVisible($h)) {
$len = [W]::GetWindowTextLength($h)
if ($len -gt 0) {
$sb = New-Object System.Text.StringBuilder($len + 1)
[W]::GetWindowText($h,$sb,$sb.Capacity) | Out-Null
$r = New-Object W+RECT
[W]::GetWindowRect($h,[ref]$r) | Out-Null
[void]$list.Add(("{0}|{1}|{2},{3},{4},{5}" -f $h,$sb.ToString(),$r.Left,$r.Top,$r.Right,$r.Bottom))
}
}
return $true
}
[W]::EnumWindows($cb,[IntPtr]::Zero) | Out-Null
$list | ForEach-Object { Write-Output $_ }