import winex; import process; import console; //查找进程主窗体 fintMainHwnd = function(pid){ var rhwnd,rtilte; for hwnd,title,theadId,processId in winex.each( ) { if( pid= processId ){ if( ! win.getParent(hwnd) ){ if( win.isVisible(hwnd) ) return hwnd,title; rhwnd,rtilte = hwnd,title; } } } return rhwnd,rtilte; } //查找进程 var prcs = process.find("AAuto Quicker.exe"); //显示主窗体 console.log( fintMainHwnd( prcs.id ) );
参考下面基础代码:遍历进程获取窗口、标题、线程ID、进程ID
import winex; import process; import console; var prcs = process.find("AAuto Quicker.exe") for hwnd,title,theadId,processId in winex.each( ) { if( prcs.id = processId ){ console.log(hwnd,title) } }