// 问题描述
// 在aardio IDE 中运行测试,截图功能可以识别窗口控件
// 发布为exe文件后运行测试,截图功能不能识别窗口控件,只能手动框选
// aardio IDE 版本 v43.2.3
// 系统版本: Windows 11 专业版 25H2
import win;
import win.ui;
import fsys;
import key;
import godking.PrScrn.light;
/*DSG{{*/
winform = win.form(text="截图测试";right=757;bottom=467)
winform.add(
static={cls="static";text="按下 Shift+S 截图";left=166;top=93;right=386;bottom=131;font=LOGFONT(h=-27);transparent=1;z=1}
)
/*}}*/
startScreenshot = function(){
godking.PrScrn.light();
}
screenshotHotkeyId = null;
registerScreenshotHotkey = function(hotkeyStr){
if(screenshotHotkeyId != null){
winform.unreghotkey(screenshotHotkeyId);
screenshotHotkeyId = null;
}
if(hotkeyStr == null){hotkeyStr = "Shift+S";}
var hotkeyStr = "Shift+S";
var arr = string.split(hotkeyStr, "+");
var k1 = key.VK;
var keys1 = 0;
var keys2 = "";
for(i=1;#arr-1;1){
var mod = arr[i];
if(mod == "Ctrl"){keys1 += 2;}
else if(mod == "Shift"){keys1 += 4;}
else if(mod == "Alt"){keys1 += 1;}
}
var lastKey = arr[#arr];
for (var key in k1){
if (key == string.upper(lastKey)){
keys2 = k1[key];
break;
}
}
if(keys2){
screenshotHotkeyId = winform.reghotkey(
function(id, mod, vk){
startScreenshot();
},
keys1, keys2
);
}
}
registerScreenshotHotkey();
winform.show();
return win.loopMessage();