WinGetProcess

首页  后退  前进

WinGetProcess
down2

WinGetProcess

获取窗口关联的进程 ID(PID).

 

WinGetProcess ( "title" [, "text"] )

参数

title

目标窗口标题, 或句柄, 或类名. 参考 窗口标题与文本.

text

[可选] 目标窗口文本. 默认值为空字符串. 参考 窗口标题与文本.

返回值

成功:

返回进程 ID (PID).

失败:

返回 -1. 未发现目标窗口.

 

函数示例

#include <MsgBoxConstants.au3>
Example()
Func Example()
    ; Run Notepad
    Run("notepad.exe")
    ; Wait 10 seconds for the Notepad window to appear.
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ; Retrieve the PID of Notepad using the window handle returned by WinWait.
    Local $iPID = WinGetProcess($hWnd)
    ; Display the PID of the window.
    MsgBox($MB_SYSTEMMODAL, "", "The PID is: " & $iPID)
    ; Close the Notepad window using the handle returned by WinWait.
    WinClose($hWnd)
EndFunc   ;==>Example

----------------------------------------

 

该函数可以通过命令调用 exect

参见:

ProcessWait, ProcessWaitClose, ProcessList

例子
copy

exect=$var_ipid=WinGetProcess('[CLASS:TTOTAL_CMD]')||_ViewValues($var_ipid) ;; 获取Total Commander进程的PID

up2

tcimage © Аверин Андрей для Total Commander Image Averin-And@yandex.ru