如何通过PID定位进程?我有同一个程序的多个实例同时处于活动状态,但我的代码仅适用于一个.我想针对所有实例.
那么在哪里放置PID(我的意思是第一行)或者如何区分多个实例?
Global $WindowTitle = "World of Warcraft"
Global $PauseKey = "{F7}"
Global $TerminateKey = "{F8}"
Global $PVPOpenKey = "{h}"
Global $MacroBindKey = "{8}{a}"
Global $Paused = False
HotKeySet( $PauseKey, "Pause" )
HotKeySet( $TerminateKey, "Terminate" )
While 1
If Not $Paused Then
ControlSend( $WindowTitle, "", 0, $PVPOpenKey )
Sleep( 5000 )
ControlSend( $WindowTitle, "", 0, $MacroBindKey )
EndIf
Sleep( 500 )
WEnd
Func Pause()
$Paused = Not $Paused
EndFunc
Func Terminate()
Exit
EndFunc
Run Code Online (Sandbox Code Playgroud)
为了获得您可以使用的某些进程的所有PID ProcessList().
; List PIDs for wow.exe processes
$list = ProcessList("wow.exe")
For $i = 1 To $list[0][0]
MsgBox(0, "Hi!", $list[$i][1])
Next
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1413 次 |
| 最近记录: |