开发者

Resizing a window (not the application window) with HTA

开发者 https://www.devze.com 2023-03-16 12:10 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号