matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [Help] Enumerate all windows.
js code: var oWindows = {}
function __enum () {
Interop.Call('user32', 'EnumWindows', Interop.GetCallbackPtr('EnumWindowsProc'), 0);
for (var oWindow in oWindows) {
Debug.Trace(oWindow+' : '+oWindows[oWindow]);
}
}
function EnumWindowsProc(hWnd, lParam) {
oWindows[hWnd] = GetWindowTitle(hWnd);
return true;
}
function GetWindowTitle(hWnd) {
var l = Interop.Alocate('user32', 'GetWindowTextLengthW', hWnd);
var s = Interop.Allocate(l*2+2)
Interop.Call('user32', 'GetWindowTextW', hWnd, s, l);
return s.ReadString(0);
}
|
|