Resizing a window (not the application window) with HTA
This is a interesting question. We are trying to resize another window (not the application window, and not it's child), in a HTA environnement.
I found the following code to read the processId
// Process name
var objWMIService = GetObject('winmgmts:root\\CIMV2');
e = new Enumerator(objWMIService.ExecQuery('SELECT * FROM Win32_Pro开发者_运维技巧cess'));
for(; !e.atEnd(); e.moveNext()) {
var s = e.item();
$('body').append('<p>' + s.Name + " ; " + s.Description + " ; " + s.ProcessID + '</p>');
}
The code works on Windows XP, it has not been tested on windows7.
Is there any way to do the same to get the running windows on a PC.
Thanks
In order to trap the processId of the launched application you need to use the function Exec from WScript.Shell.
Full documentation : http://msdn.microsoft.com/en-us/library/x78640t0(v=VS.85).aspx
精彩评论