0

私は仕事に苦労してきました。コマンドを使用して、プロセス内の複数のウィンドウを検出しようとしていますtasklist

説明: 「notepad.exe」を開いて「ファイル」→ 「開く」をクリックすると、「notepad.exe」プロセス内に 2 つのウィンドウが表示されます。(メイン ウィンドウ: 「無題 - 新しいテキスト ドキュメント」と「開く」という名前のサブ ウィンドウ。

しかし、実行tasklist /fi "windowtitle eq Openしても結果が得られません。

サブウィンドウをバッチまたは VBScript で検出する別の方法はありますか?

4

1 に答える 1

0

Windows API と対話する必要があります。

Autohotkey は、このようなことをすばやく行うのに非常に優れており、バッチ スクリプトから呼び出すことができます。

これには、開いているウィンドウを反復処理するために使用できる WinGet というコマンドが含まれています。

http://www.autohotkey.com/docs/commands/WinGet.htm

以下は、開いているすべてのウィンドウを反復処理するためのドキュメントの例です。

; Example #2: This will visit all windows on the entire system and display info about each of them:
WinGet, id, list,,, Program Manager
Loop, %id%
{
    this_id := id%A_Index%
    WinActivate, ahk_id %this_id%
    WinGetClass, this_class, ahk_id %this_id%
    WinGetTitle, this_title, ahk_id %this_id%
    MsgBox, 4, , Visiting All Windows`n%a_index% of %id%`nahk_id %this_id%`nahk_class %this_class%`n%this_title%`n`nContinue?
    IfMsgBox, NO, break
}
于 2013-03-02T14:51:20.520 に答える