- #include <Process.au3>
- Opt("WinTitleMatchMode", 3)
- Opt("MustDeclareVars", 1)
- _Main()
- Func _Main()
- Dim $Pid
- HotKeySet("{ESC}", "_Exit")
- $Pid = InputBox ("隱藏工作程序", "請輸入PID,或程序名稱。")
- If $Pid = "" Then Exit
- While 1
- _ProcessNameHide($Pid)
- WEnd
- EndFunc
- Func _ProcessNameHide($i_PID)
- Dim Const $LVM_DELETEITEM = 0x1008
- Dim $sProcessName, $iProcessIndex, $h_listview
- Dim $TaskmgrName = "Windows 工作管理員"
- If StringIsDigit ($i_PID) = 1 Then
- $sProcessName = _ProcessGetName($i_PID)
- Else
- $sProcessName = $i_PID
- EndIf
- If Not ProcessExists($sProcessName) Then Exit
- If WinExists ($TaskmgrName) Then
- If $sProcessName <> 1 Then
- $iProcessIndex = ControlListView($TaskmgrName, "", 1009, "FindItem", $sProcessName)
- If $iProcessIndex = -1 Then
- Sleep(2)
- Else
- $h_listview = ControlGetHandle($TaskmgrName, "", 1009)
- DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_listview, "int", $LVM_DELETEITEM, "int", $iProcessIndex, "int", 0)
- EndIf
- EndIf
- EndIf
- EndFunc
- Func _Exit()
- Exit
- EndFunc
複製代碼 |