aardio 文档

aardio 范例: 等待进程主窗口

//等待主窗口
import win.ui;
/*DSG{{*/
var winform = win.form(text="等待进程主窗口";right=349;bottom=249;parent=...)
winform.add(
btnRun={cls="button";text="打开写字板";left=71;top=66;right=293;bottom=114;z=1}
)
/*}}*/

winform.btnRun.oncommand = function(id,event){

    thread.invoke( 
        function(winform){ 
            import process;
            import winex; 

            var prcs = process.shell("wordpad.exe");
            if(!prcs) return winform.msgboxErr("未安装写字板");

            winform.btnRun.disabledText = "等待写字板主窗口...";
            prcs.waitMainWindow(); 

            winform.btnRun.disabledText = "等待写字板关闭...";
            prcs.wait();

            winform.btnRun.disabledText = null;
            winform.btnRun.text = "已完成";
        }
        ,winform
    )  
}

winform.show();
win.loopMessage();

Markdown 格式