Code: Select all
IsProcessSuspended(pid) {
For thread in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Thread WHERE ProcessHandle = " pid)
If (thread.ThreadWaitReason != 5)
Return False
Return True
}
F2::
Process, Exist, hh.exe
pid := ErrorLevel
If (!IsProcessSuspended(pid))
SuspendProcess(pid)
Return
F3::
Process, Exist, hh.exe
pid := ErrorLevel
If (IsProcessSuspended(pid))
ResumeProcess(pid)
Return
I read the documentation for ComObjGet, I'm not sure where I'm going wrong..Error at line 2 in #include file "C:\Program Files\AutoHotkey\Lib\IsProcessSuspended.ahk".
Line Text: For thread in ComObjGet("winmgmts").ExecQuery("Select * from Win32_Thread WHERE ProcessHandle = ...
Error: This line does not contain a recognized action.
Win7 64
AHK 1.1.26.01