#NoTrayIcon #include #include #include #include #include #include #include #include $Width = 400 $Height = 800 $ListViewWidth = 400 $ListViewHeight = 774 $mainForm = GUICreate("Process Priority", $Width, $Height) $mainMenu = GUICtrlCreateMenu("Help") $helpMenuItem = GUICtrlCreateMenuItem("Help", $mainMenu) $aboutMenuItem = GUICtrlCreateMenuItem("About", $mainMenu) $RefreshButton = GUICtrlCreateButton("Refresh", 0, 774, $Width, 25) Global $List = GUICtrlCreateListView("Process Name|PID|Priority", 0, 0, $ListViewWidth, $ListViewHeight, BitOR($LVS_SINGLESEL, $LVS_SHOWSELALWAYS), BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES)) _GUICtrlListView_SetColumnWidth($List, 0, $ListViewWidth / 3) _GUICtrlListView_SetColumnWidth($List, 1, $ListViewWidth / 3) _GUICtrlListView_SetColumnWidth($List, 2, ($ListViewWidth / 3) - 25) $ContextMenu = GUICtrlCreateContextMenu($List) $SetProcPrioMenu = GUICtrlCreateMenu("Set Process Priority", $ContextMenu) $SetProcPrio0 = GUICtrlCreateMenuItem("0", $SetProcPrioMenu) $SetProcPrio1 = GUICtrlCreateMenuItem("1", $SetProcPrioMenu) $SetProcPrio2 = GUICtrlCreateMenuItem("2", $SetProcPrioMenu) $SetProcPrio3 = GUICtrlCreateMenuItem("3", $SetProcPrioMenu) $SetProcPrio4 = GUICtrlCreateMenuItem("4", $SetProcPrioMenu) $SetProcPrio5 = GUICtrlCreateMenuItem("5", $SetProcPrioMenu) $CloseProcess = GUICtrlCreateMenuItem("Close Process", $ContextMenu) $TerminateProcess = GUICtrlCreateMenuItem("Terminate Process", $ContextMenu) writeProcessPriorityList() Func writeProcessPriorityList() $aProcess = ProcessList() For $i = 1 To $aProcess[0][0] $Priority = _ProcessGetPriority($aProcess[$i][1]) If $Priority <> -1 Then GUICtrlCreateListViewItem($aProcess[$i][0] & "|" & $aProcess[$i][1] & "|" & $Priority, $List) EndIf Next _ArrayDelete($aProcess, 0) GUISetState() EndFunc While 1 Switch GUIGetMsg() Case $helpMenuItem _ExtMsgBoxSet(0, 1, "0xCAEAF4", "0x394042", 0, "Roboto-Thin") _ExtMsgBox(0, "mkay", "Process Priority - Help", "DISCLAIMER: setting a Process Priority to 5 may make the system unstable!!" & @CRLF & "Note that not all Process may be listed on in this program since you cant change the Priorities of all running processes.", 0, $mainForm) Case $aboutMenuItem _ExtMsgBoxSet(0, 1, "0xCAEAF4", "0x394042", 0, "Roboto-Thin") _ExtMsgBox(0, "okay... cool", "Process Priority - About", "This Tool can be used to set the Priority of certain Processes." & @CRLF & "Author: Lazeyyy" & @CRLF & "You may do whatever the f**k you want with this as long as youre not an a****le and say you that you developed it ;)", 0, $mainForm) Case -3 Exit 1 Case $RefreshButton _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $CloseProcess $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessClose($Proc) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error value: " & @error) ConsoleWrite("! [ERROR] ProcessClose() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Closed succesfully" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $TerminateProcess $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = _WinAPI_TerminateProcess($Proc) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error value: " & @error) ConsoleWrite("! [ERROR] _WinApi_TerminateProcess() returned False" & @CRLF) Else ConsoleWrite("+ Process Termination succesful" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $SetProcPrio0 $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 0) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 0" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $SetProcPrio1 $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 1) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 1" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $SetProcPrio2 $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 2) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 2" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $SetProcPrio3 $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 3) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 3" & @CRLF) EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() Case $SetProcPrio4 $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 4) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 4" & @CRLF) EndIf Case $SetProcPrio5 $yesno = MsgBox(48 + 4, "Process Booster", "Setting a Process Priority to 5 may make the system unstable!" & @CRLF & "Do you want to continue?") If $yesno = 7 Then ContinueCase Else $Proc = StringTrimRight(GUICtrlRead(GUICtrlRead($List)), 1) $Delimiter1 = StringInStr($Proc, "|") $Proc = StringTrimLeft(StringTrimRight($Proc, 2), $Delimiter1) $rtn = ProcessSetPriority($Proc, 5) If Not $rtn Then MsgBox(16, "Process Priority", "An Error occured. Error Value: " & @error) ConsoleWrite("! [ERROR] ProcessSetPriority() returned: " & $rtn & " With an @error Value of: " & @error & "; Extended: " & @extended & @CRLF) Else ConsoleWrite("+ Process Priority succesfully set to 5" & @CRLF) EndIf EndIf _GUICtrlListView_DeleteAllItems($List) writeProcessPriorityList() EndSwitch WEnd