aardio 嵌入 其他应用程序
需求
这个chrome壳不能进行拖拽和缩放,所以再套一个壳,可以再分屏的时候用
import win.ui;
/*DSG{{*/
winform = win.form(text="数字化加工 - 一定先关闭内部的chrome,再关闭本程序";right=959;bottom=591)
winform.add(
custom={cls="custom";text="自定义控件";left=767;top=13;right=1373;bottom=467;z=2};
static={cls="static";left=0;top=0;right=959;bottom=591;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
import winex;
import process;
var exeUrl = "C:Program Filesdpsys数字化加工系统win64.exe"
pid = process.execute(exeUrl)
//win.delay(5000)
chwnd = winex.waitVisible(,,,,,pid)
//win.delay(5000)
// 让外部窗口成为自身的悬浮窗口,吸附并可显示在外面
//winform.custom.orphanWindow(,chwnd)
//process.executeWaitInput(exeUrl);//运行记事本
//var prcs = process(exeUrl);
//win.delay(5000)
//var hwnd1 = winex.find("SunAwtToolkit",,prcs.id);
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit","<RichEditD2DPT>|<Edit>");//查找句柄
//SunAwtFrame
//SunAwtToolkit
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
winex.orphanWindow(winform.static,chwnd)
//退出程序前让记事本退出
winform.onClose = function(hwnd,message,wParam,lParam){
if(!winex.closeAndWait(chwnd)) return 1;
}
/*
prcs=process(exeUrl);
for hwnd,title,tid,pid in winex.each( ) {
if(pid == prcs.id){
io.open()
io.print("窗口句柄",string.format("%x",hwnd),"窗口类",win.getClass(hwnd),"进程ID",prcs.id,'
')
}
}
*/
//窗口句柄 3023e4 窗口类 SunAwtToolkit 进程ID 32356
//process.executeWaitInput(exeUrl);//运行记事本
//
//var hwndNotepad,hNotepadEdit = winex.wait(,,"Chrome_RenderWidgetHostHWND", "SunAwtToolkit");//查找句柄
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit");//查找句柄
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
//winex.orphanWindow(mainForm.static,hwndNotepad)
winform.show();
return win.loopMessage();
更新了一版 ini 配置exe地址的
import win.ui;
/*DSG{{*/
winform = win.form(text="数字化加工 - 一定先关闭内部的chrome,再关闭本程序";right=959;bottom=591)
winform.add(
custom={cls="custom";text="自定义控件";left=767;top=13;right=1373;bottom=467;z=2};
static={cls="static";left=0;top=0;right=959;bottom=591;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
import winex;
import process;
import fsys.ini
ini=fsys.ini("config.ini") // 编码格式要GBK ansi, utf8会有乱码
sec = ini.getSection("appSection")
//sec.app
//io.open()
//io.print(sec.app)
//import inet.url;
//sec.app = "C:Program Filesdpsys数字化加工系统win64.exe"
//sec.save()
//var exeUrl = string.fromto(sec.app, 936, 65001) // "C:Program Filesdpsys数字化加工系统win64.exe"
var exeUrl = sec.app
pid = process.execute(exeUrl)
io.print(exeUrl)
//win.delay(5000)
chwnd = winex.waitVisible(,,,,,pid)
//win.delay(5000)
// 让外部窗口成为自身的悬浮窗口,吸附并可显示在外面
//winform.custom.orphanWindow(,chwnd)
//process.executeWaitInput(exeUrl);//运行记事本
//var prcs = process(exeUrl);
//win.delay(5000)
//var hwnd1 = winex.find("SunAwtToolkit",,prcs.id);
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit","<RichEditD2DPT>|<Edit>");//查找句柄
//SunAwtFrame
//SunAwtToolkit
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
winex.orphanWindow(winform.static,chwnd)
//退出程序前让记事本退出
winform.onClose = function(hwnd,message,wParam,lParam){
if(!winex.closeAndWait(chwnd)) return 1;
}
/*
prcs=process(exeUrl);
for hwnd,title,tid,pid in winex.each( ) {
if(pid == prcs.id){
io.open()
io.print("窗口句柄",string.format("%x",hwnd),"窗口类",win.getClass(hwnd),"进程ID",prcs.id,'
')
}
}
*/
//窗口句柄 3023e4 窗口类 SunAwtToolkit 进程ID 32356
//process.executeWaitInput(exeUrl);//运行记事本
//
//var hwndNotepad,hNotepadEdit = winex.wait(,,"Chrome_RenderWidgetHostHWND", "SunAwtToolkit");//查找句柄
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit");//查找句柄
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
//winex.orphanWindow(mainForm.static,hwndNotepad)
winform.show();
return win.loopMessage();
关闭直接杀掉进程,因为内层 还弹框问是否关闭
import win.ui;
/*DSG{{*/
winform = win.form(text="数字化加工 - 要配置好 app 和 fileName 打开和关闭按钮才能用";right=959;bottom=591)
winform.add(
custom={cls="custom";text="自定义控件";left=767;top=13;right=1373;bottom=467;z=2};
static={cls="static";left=0;top=0;right=959;bottom=591;db=1;dl=1;dr=1;dt=1;z=1}
)
/*}}*/
import winex;
import process;
import fsys.ini
ini=fsys.ini("config.ini") // 编码格式要GBK ansi, utf8会有乱码
sec = ini.getSection("appSection")
//sec.app
//io.open()
//io.print(sec.app)
//import inet.url;
//sec.app = "C:Program Filesdpsys数字化加工系统win64.exe"
//sec.save()
//var exeUrl = string.fromto(sec.app, 936, 65001) // "C:Program Filesdpsys数字化加工系统win64.exe"
var exeUrl = sec.app
var fileName = sec.fileName
pid = process.execute(exeUrl)
io.print(exeUrl)
//win.delay(5000)
chwnd = winex.waitVisible(,,,,,pid)
//win.delay(5000)
// 让外部窗口成为自身的悬浮窗口,吸附并可显示在外面
//winform.custom.orphanWindow(,chwnd)
//process.executeWaitInput(exeUrl);//运行记事本
//var prcs = process(exeUrl);
//win.delay(5000)
//var hwnd1 = winex.find("SunAwtToolkit",,prcs.id);
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit","<RichEditD2DPT>|<Edit>");//查找句柄
//SunAwtFrame
//SunAwtToolkit
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
winex.orphanWindow(winform.static,chwnd)
//退出程序前让记事本退出
winform.onClose = function(hwnd,message,wParam,lParam){
process.kill(fileName)
//var t = !winex.closeAndWait(chwnd)
//io.open()
//io.print(t)
//if(t) return 1;
}
/*
prcs=process(exeUrl);
for hwnd,title,tid,pid in winex.each( ) {
if(pid == prcs.id){
io.open()
io.print("窗口句柄",string.format("%x",hwnd),"窗口类",win.getClass(hwnd),"进程ID",prcs.id,'
')
}
}
*/
//窗口句柄 3023e4 窗口类 SunAwtToolkit 进程ID 32356
//process.executeWaitInput(exeUrl);//运行记事本
//
//var hwndNotepad,hNotepadEdit = winex.wait(,,"Chrome_RenderWidgetHostHWND", "SunAwtToolkit");//查找句柄
//var hwndNotepad,hNotepadEdit = winex.wait(,,"SunAwtToolkit");//查找句柄
//悬浮影子窗口:外部进程窗口附加到 winform.static 并如影随形的自适应缩放调整位置
//winex.orphanWindow(mainForm.static,hwndNotepad)
winform.show();
return win.loopMessage();
本文摘自 :https://www.cnblogs.com/