できます。
具体的には Program Manager のクラス名から探します。
#module
#uselib "user32.dll"
#cfunc GetDesktopWindow "GetDesktopWindow"
#cfunc GetWindow "GetWindow" int, int
#cfunc GetWindowText "GetWindowTextA" int, int, int
#cfunc IsWindowVisible "IsWindowVisible" int
#uselib "kernel32.dll"
#cfunc lstrcmp "lstrcmp" int, int
#define MAX_PATH 260
#define GW_OWNER $00000004
#define GW_HWNDNEXT $00000002
#define GW_CHILD $00000005
#deffunc GetProcList var prm1
WndDesk = GetDesktopWindow()
if WndDesk != 0 {
WndCurWin = GetWindow(WndDesk, GW_CHILD)
}else{
return -1
}
sdim buf, 64
sdim szClassName, MAX_PATH
sdim chWinTxt, MAX_PATH
count = 0
while WndCurWin != 0
await 15
ret = GetWindowText(WndCurWin, varptr(chWinTxt), MAX_PATH)
if chWinTxt != "" {
vs = IsWindowVisible(WndCurWin)
if vs != 0 {
owhwnd = GetWindow(WndCurWin, GW_OWNER)
if owhwnd == 0 {
if chWinTxt != "Program Manager" {
lpString = "Progman"
cp = lstrcmp(varptr(szClassName), varptr(lpString))
if cp != 0 {
i = WndCurWin
buf += str(i) + "," + chWinTxt + "\n"
count ++
}
}
}
}
}
WndCurWin = GetWindow(WndCurWin, GW_HWNDNEXT)
wend
prm1 = buf
sdim szClassName
sdim chWinTxt
sdim buf
return count
#global
//タイトル取得開始
sdim buf, 256
sdim tit, 256
temp = str(temp) : work = str(work)
getproclist temp : num = stat
notepos = 0 : count = 0
sdim mhwnd, 8, num : sdim proctitle, 260, num
repeat num
await 15
repeat 2
getstr work, temp, notepos,','
notepos += strsize
if cnt == 1 : proctitle(count) = work
loop
buf += proctitle(count) + "\n";bufにタイトルを詰め込む
count ++
loop
mes "取得したタイトル:\n\n" + buf + "\n"
stop
Win XP, 7 では動作確認しました。
ただ、クラス名や親ウィンドウがWindowsのバージョンによって
変わっていた経験が一度あります。
なのでWin8で動くかは分かりません。