From f0b9d1beec599239fd38f720cb3c2cffc31c56d6 Mon Sep 17 00:00:00 2001 From: yu <191972707@qq.com> Date: Mon, 2 Nov 2026 17:02:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CV=20=E8=A7=86=E8=A7=89=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=88=AA=E5=B1=8F=E8=84=9A=E6=9C=AC=E8=A1=A5=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=20System.Windows.Forms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - grabScreen 只 Add-Type 了 System.Drawing, 引用 Windows.Forms.Screen 却未加载该程序集 - 导致 PrimaryScreen.Bounds 取值为 Null, 截屏链路 InvokeMethodOnNull, 所有 CV_* 组件运行失败 - 与 remaining-core.ts 中正常工作的同款脚本对齐 --- src/main/capabilities/cv-vision.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/capabilities/cv-vision.ts b/src/main/capabilities/cv-vision.ts index d3935ee..c80dfed 100644 --- a/src/main/capabilities/cv-vision.ts +++ b/src/main/capabilities/cv-vision.ts @@ -27,6 +27,7 @@ async function grabScreen(imagePath: string): Promise { fs.mkdirSync(path.dirname(imagePath), { recursive: true }); const psScript = [ "Add-Type -AssemblyName System.Drawing | Out-Null;", + "Add-Type -AssemblyName System.Windows.Forms | Out-Null;", "$b = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds;", "$bmp = New-Object System.Drawing.Bitmap($b.Width, $b.Height);", "$g = [System.Drawing.Graphics]::FromImage($bmp);",