fix: Dialog_Notice/MsgBox MessageBox options arg - invalid HelpButton value
Previous topmost attempt passed 'HelpButton' in the MessageBoxOptions position of MessageBox::Show, so PowerShell failed at runtime with "cannot convert value HelpButton to type System.Windows.Forms.MessageBoxOptions" (reproduced in flow run: notice node failed at char 196). Now passes the documented MB_TOPMOST flag (MessageBoxOptions)262144 as the 6th argument, keeping the six-argument overload (OK / Information / Button1 / topmost).
This commit is contained in:
parent
0db3e59f75
commit
124f11bd6b
@ -154,7 +154,9 @@ const notice: CapabilityHandler = async (_ctx, _node, args) => {
|
||||
// MessageBox 阻塞等用户点确定,同样不能吃 powershell() 默认 30s 超时;且 MB_TOPMOST 保证弹窗不被主窗口盖住
|
||||
const waitSeconds = number(args, ["wait_time", "waitTime", "timeout"], 600);
|
||||
const timeoutMs = Math.max(10000, Math.round(waitSeconds * 1000));
|
||||
await powershell(`Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show(${psString(content)},${psString(title)},'OK','Information','Button1','HelpButton',1) | Out-Null`, timeoutMs);
|
||||
// MessageBoxOptions 第 6 参数用 MB_TOPMOST(0x40000=262144) 标志位实现置顶;此前误传 'HelpButton'(图标枚举值)
|
||||
// 导致 PowerShell 类型转换失败「无法将 HelpButton 转换为 MessageBoxOptions」
|
||||
await powershell(`Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show(${psString(content)},${psString(title)},'OK','Information','Button1',[System.Windows.Forms.MessageBoxOptions]262144) | Out-Null`, timeoutMs);
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user