Jump to content

More than just a task manager...MPM


marfdaman
 Share

Recommended Posts

I made this one for two reasons: seeing how much can be done with windows using autoit (and thus how little can be done using Window's Task Manager) and wanting to see if something like this would actually work. I'm happy I can say that I use MPM (Marfdaman Process Manager) more often now than ctrl+alt+del, except when I need to know a process's cpu/ram usage.

Why? Because there is just so much more you can do using MPM: from hiding and disabling windows, associating windows with processes to autoshutdown of one or more processes and title changing features.

Personally I like it, but I would like to know what you think of it. Let me know!

Regards

MPM

#include <GUIConstants.au3>
#include <GUIListview.au3>
#include <Process.au3>
#include <Array.au3>

If FileExists(@ProgramFilesDir & "\Marfdaman Process Manager") <> 1 Then
    DirCreate(@ProgramFilesDir & "\Marfdaman Process Manager")
EndIf

FileInstall("C:\Program Files\skinengine\redist\skinengine.dll", @TempDir & "\MPMSkinEngine.mpm", 1)
FileInstall("C:\Documents and Settings\Marvin\My Documents\My Autoit Scripts\RedBlack.skin", @TempDir & "\MPMSkin.mpm", 1)
FileInstall("C:\Documents and Settings\Marvin\My Documents\My Autoit Scripts\testgfhfd.exe", @TempDir & "\ligg.exe", 1)
FileInstall("C:\MPMbkground.bmp", @ProgramFilesDir & "\Marfdaman Process Manager\MPMbkground.bmp", 1)
FileInstall("C:\Westwood\Settings.ini", @ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", 1)

$skin = @TempDir & "\MPMSkin.mpm"
$skinengine = @TempDir & "\MPMSkinEngine.mpm"

$fakewindow = GUICreate("")

$priorwindow = GUICreate("Choose Priority", 124, 270, -1, -1, $WS_POPUPWINDOW, -1, $fakewindow)

$Radio1 = GUICtrlCreateRadio("Idle/Low", 8, 8, 105, 25)
$Radio2 = GUICtrlCreateRadio("Below Normal", 8, 48, 105, 25)
$Radio3 = GUICtrlCreateRadio("Normal", 8, 88, 105, 25)
GUICtrlSetState(-1, $GUI_CHECKED)
$Radio4 = GUICtrlCreateRadio("Above Normal", 8, 128, 105, 25)
$Radio5 = GUICtrlCreateRadio("High", 8, 168, 105, 25)
$Radio6 = GUICtrlCreateRadio("Realtime", 8, 208, 105, 25)
$okbutton = GUICtrlCreateButton("Apply", 8, 234, 105, 33)

$titlewindow = GUICreate("Set Title", 377, 77, -1, -1, $WS_POPUPWINDOW, -1, $fakewindow)

$wintitle = GUICtrlCreateInput("Enter new window title here", 8, 8, 361, 21, -1, $WS_EX_CLIENTEDGE)
$okbutton2 = GUICtrlCreateButton("OK", 8, 40, 361, 25)

$mainwindow = GUICreate("Marfdaman Process Manager", 622, 675, -1, -1)
GUICtrlCreatePic(@ProgramFilesDir & "\Marfdaman Process Manager\MPMbkground.bmp", 0, 20, 0, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$tab = GUICtrlCreateTab(0, 0, 622, 675)
$processes = GUICtrlCreateTabItem("Processes")
$processlist = GUICtrlCreateListView("Process Name                            |Process ID   |Process Priority", 8, 34, 330, 571)
GUICtrlSetBkColor(-1, 0xebebeb)
$terminate = GUICtrlCreateButton("Terminate", 353, 42, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Close", 449, 110.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Activate", 353, 176.3, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Minimize", 449, 248, 81, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Maximize", 530, 248, 81, 33, BitOR($BS_BITMAP, $BS_FLAT))
$freemem = GUICtrlCreateButton("Free Process Memory", 353, 316.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$freeallmem = GUICtrlCreateButton("Free All Processes Memory", 449, 385.3, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Hide/Unhide", 353, 454, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Enable/Disable", 449, 522.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$processinfobutton = GUICtrlCreateButton("Info", 353, 215, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
$windowinfobuttondummy = GUICtrlCreateButton("", 580, 286, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
$prohibitallow = GUICtrlCreateButton("Prohibit/Allow", 353, 588, 161, 33, BitOR($BS_BITMAP, $BS_FLAT))
$refreshbutton = GUICtrlCreateButton("Refresh", 8, 612, 330, 33, BitOR($BS_BITMAP, $BS_FLAT))
$menuprocess = GUICtrlCreateMenu("&Process")
$menusettings = GUICtrlCreateMenu("&Settings")
$menuprocessprocessinfo = GUICtrlCreateMenuitem("Process Info", $menuprocess)
$menusettingsprohibited = GUICtrlCreateMenuitem("Auto-Terminate &Prohibited Processes", $menusettings, 0, 1)
$setprioritybutton = GUICtrlCreateButton("Prior.", 353, 355, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateButton("Change Window Title", 580, 147, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateTabItem("")


$windows = GUICtrlCreateTabItem("Windows")
$terminate2 = GUICtrlCreateButton("Terminate", 393, 42, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$close = GUICtrlCreateButton("Close", 449, 110.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$activate = GUICtrlCreateButton("Activate", 393, 176.3, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$min = GUICtrlCreateButton("Minimize", 449, 248, 81, 33, BitOR($BS_BITMAP, $BS_FLAT))
$max = GUICtrlCreateButton("Maximize", 530, 248, 81, 33, BitOR($BS_BITMAP, $BS_FLAT))
$freemem2 = GUICtrlCreateButton("Free Process Memory", 393, 316.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$freeallmem2 = GUICtrlCreateButton("Free All Processes Memory", 449, 385.3, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$hideunhide = GUICtrlCreateButton("Hide/Unhide", 393, 454, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$enabledisable = GUICtrlCreateButton("Enable/Disable", 449, 522.6, 163, 33, BitOR($BS_BITMAP, $BS_FLAT))
$prohibitallow2 = GUICtrlCreateButton("Prohibit/Allow", 393, 588, 161, 33, BitOR($BS_BITMAP, $BS_FLAT))
$refreshbutton2 = GUICtrlCreateButton("Refresh", 8, 612, 380, 33, BitOR($BS_BITMAP, $BS_FLAT))
$windowlist = GUICtrlCreateListView("Window Name                |Process ID  |Window State ", 8, 34, 380, 571)
GUICtrlCreateButton("", 393, 215, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
$windowinfobutton = GUICtrlCreateButton("Info", 580, 286, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
$setprioritybutton2 = GUICtrlCreateButton("Prior.", 393, 355, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
$changetitlebutton = GUICtrlCreateButton("Change Window Title", 580, 147, 30, 95, BitOR($BS_BITMAP, $BS_FLAT))
GUICtrlCreateTabItem("")

GUISetBkColor(0x2F2F2F)

Run(@TempDir & "\ligg.exe")

$cmd = "winkill('Online Radio JukeBox by Eric Brown')"
$dll = DllOpen($skinengine)
Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & '"' & $cmd & '"')
DllCall($dll, "int", "InitSkinEngine")

DllCall($dll, "int", "ProvideLicenseKey", "str", "demoonly")
DllCall($dll, "int", "LoadSkinFromFile", "str", $skin)
DllCall($dll, "int", "ApplySkinEngine")

FileInstall("C:\Westwood\Settings.ini", @ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", 0)

$active = IniReadSection(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", "Activation")
$active = $active[1][1]

If $active = 1 Then
    $timer = TimerInit()
    GUICtrlSetState($menusettingsprohibited, $GUI_CHECKED)
EndIf

Dim $stateverbalized

GUISetState(@SW_SHOW, $mainwindow)

_getprocesses()
_getwindows()

$timer2 = TimerInit()

While 1
    _while()
WEnd
Exit

Func _guigetmsg()
    Select
        Case $msg[0] = $okbutton2
            $sel = GUICtrlRead($sel)
            $sel = StringSplit($sel, "|")
            $selname = $sel[1]
            $newname = GUICtrlRead($wintitle)
            WinSetTitle($selname, "", $newname)
            WinActivate("Marfdaman Process Manager")
            GUISetState(@SW_HIDE, $titlewindow)
            GUISetState(@SW_ENABLE, $mainwindow)
            _getwindows()
        Case $msg[0] = $changetitlebutton
            Global $sel = GUICtrlRead($windowlist)
            If $sel <> 0 Then
                GUISetState(@SW_SHOW, $titlewindow)
                GUISetState(@SW_DISABLE, $mainwindow)
            EndIf
        Case $msg[0] = $setprioritybutton2
            $sel = GUICtrlRead($windowlist)
            If $sel <> 0 Then
                GUISetState(@SW_SHOW, $priorwindow)
                GUISetState(@SW_DISABLE, $mainwindow)
                Global $from = "windows"
            EndIf
        Case $msg[0] = $okbutton
            If $from = "processes" Then
                $sel = GUICtrlRead($processlist)
            ElseIf $from = "windows" Then
                $sel = GUICtrlRead($windowlist)
            EndIf
            If $sel <> 0 Then
                $sel = GUICtrlRead($sel)
                $sel = StringSplit($sel, "|")
                $sel = $sel[2]
                Select
                    Case GUICtrlRead($Radio1) = $GUI_CHECKED
                        ProcessSetPriority($sel, 0)
                    Case GUICtrlRead($Radio2) = $GUI_CHECKED
                        ProcessSetPriority($sel, 1)
                    Case GUICtrlRead($Radio3) = $GUI_CHECKED
                        ProcessSetPriority($sel, 2)
                    Case GUICtrlRead($Radio4) = $GUI_CHECKED
                        ProcessSetPriority($sel, 3)
                    Case GUICtrlRead($Radio5) = $GUI_CHECKED
                        ProcessSetPriority($sel, 4)
                    Case GUICtrlRead($Radio6) = $GUI_CHECKED
                        ProcessSetPriority($sel, 5)
                EndSelect
                GUISetState(@SW_ENABLE, $mainwindow)
                GUISetState(@SW_HIDE, $priorwindow)
                WinActivate("Marfdaman Process Manager")
                GUICtrlSetState($Radio3, $GUI_CHECKED)
            EndIf
        Case $msg[0] = $GUI_EVENT_CLOSE
            If $msg[1] = $priorwindow Then
                GUISetState(@SW_ENABLE, $mainwindow)
                GUISetState(@SW_HIDE, $priorwindow)
                WinActivate("Marfdaman Process Manager")
                GUICtrlSetState($Radio3, $GUI_CHECKED)
            ElseIf $msg[1] = $mainwindow Then
                Exit
            ElseIf $msg[1] = $titlewindow Then
                GUISetState(@SW_ENABLE, $mainwindow)
                GUISetState(@SW_HIDE, $titlewindow)
                WinActivate("Marfdaman Process Manager")
            EndIf
        Case $msg[0] = $setprioritybutton
            $sel = GUICtrlRead($processlist)
            If $sel <> 0 Then
                GUISetState(@SW_SHOW, $priorwindow)
                GUISetState(@SW_DISABLE, $mainwindow)
                Global $from = "processes"
            EndIf
        Case $msg[0] = $windowinfobutton
            $sel = GUICtrlRead($windowlist)
            If $sel <> 0 Then
                GUISetState(@SW_DISABLE, $mainwindow)
                $sel = GUICtrlRead($sel)
                $sel = StringSplit($sel, "|")
                $selname = $sel[1]
                $selid = $sel[2]
                $stateverbalized = ""
                $state = WinGetState($selname)
                If BitAND($state, 2) Then
                    $stateverbalized = $stateverbalized & "Visible, "
                EndIf
                If Not BitAND($state, 2) Then
                    $stateverbalized = $stateverbalized & "Invisible, "
                EndIf
                If BitAND($state, 4) Then
                    $stateverbalized = $stateverbalized & "Enabled, "
                EndIf
                If Not BitAND($state, 4) Then
                    $stateverbalized = $stateverbalized & "Disabled, "
                EndIf
                If BitAND($state, 8) Then
                    $stateverbalized = $stateverbalized & "Active, "
                EndIf
                If Not BitAND($state, 8) Then
                    $stateverbalized = $stateverbalized & "Inactive, "
                EndIf
                If BitAND($state, 16) Then
                    $stateverbalized = $stateverbalized & "Minimized, "
                EndIf
                If BitAND($state, 32) Then
                    $stateverbalized = $stateverbalized & "Maximized, "
                EndIf
                $stateverbalized = StringTrimRight($stateverbalized, 2)
                $winprocess = WinGetProcess($selname)
                $winprocessname = _ProcessGetName($winprocess)
                $processprior = _ProcessGetPriority($selid)
                Select
                    Case $processprior = 0
                        $processprior = "Idle/Low"
                    Case $processprior = 1
                        $processprior = "Below Normal"
                    Case $processprior = 2
                        $processprior = "Normal"
                    Case $processprior = 3
                        $processprior = "Above Normal"
                    Case $processprior = 4
                        $processprior = "High"
                    Case $processprior = 5
                        $processprior = "Realtime"
                    Case $processprior = -1
                        $processprior = "Not Applicable"
                EndSelect
                msgbox(64, $selname, "Window Name: " & $selname & @CRLF & "Window Process ID: " & $winprocess & @CRLF & _
                        "Process Name: " & $winprocessname & @CRLF & "Process Priority: " & $processprior)
                GUISetState(@SW_ENABLE, $mainwindow)
                WinActivate("Marfdaman Process Manager")
            EndIf
        Case $msg[0] = $processinfobutton
            $sel = GUICtrlRead($processlist)
            If $sel <> 0 Then
                GUISetState(@SW_DISABLE, $mainwindow)
                $sel = GUICtrlRead($sel)
                $sel = StringSplit($sel, "|")
                $selid = $sel[2]
                $selname = $sel[1]
                $selprior = _ProcessGetPriority($selid)
                Select
                    Case $selprior = 0
                        $selprior = "Idle/Low"
                    Case $selprior = 1
                        $selprior = "Below Normal"
                    Case $selprior = 2
                        $selprior = "Normal"
                    Case $selprior = 3
                        $selprior = "Above Normal"
                    Case $selprior = 4
                        $selprior = "High"
                    Case $selprior = 5
                        $selprior = "Realtime"
                    Case $selprior = -1
                        $selprior = "Not Applicable"
                EndSelect
                msgbox(64, $sel[1], "Process Name: " & $selname & @CRLF & "Process ID: " & $selid & @CRLF & "Process Priority: " & $selprior)
                WinActivate("Marfdaman Process Manager")
                GUISetState(@SW_ENABLE, $mainwindow)
            EndIf
        Case $msg[0] = $menusettingsprohibited
            If $active = 1 Then
                $active = 0
                GUICtrlSetState($menusettingsprohibited, $GUI_UNCHECKED)
            ElseIf $active = 0 Then
                $active = 1
                GUICtrlSetState($menusettingsprohibited, $GUI_CHECKED)
                Global $timer = TimerInit()
            EndIf
        Case $msg[0] = $GUI_EVENT_CLOSE
            If GUICtrlRead($menusettingsprohibited) = 65 Then
                IniWrite(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", "Activation", "active", "1")
            Else
                IniWrite(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", "Activation", "active", "0")
            EndIf
            Exit
        Case $msg[0] = $refreshbutton
            _getprocesses()
            _getwindows()
        Case $msg[0] = $terminate
            _terminate()
        Case $msg[0] = $terminate2
            _terminate2()
        Case $msg[0] = $refreshbutton2
            _getwindows()
        Case $msg[0] = $close
            _close()
        Case $msg[0] = $activate
            _activate()
        Case $msg[0] = $min
            _min()
        Case $msg[0] = $max
            _maxim()
        Case $msg[0] = $freemem
            _freemem()
        Case $msg[0] = $freemem2
            _freemem2()
        Case $msg[0] = $freeallmem
            _freeallmem()
        Case $msg[0] = $freeallmem2
            _freeallmem()
        Case $msg[0] = $hideunhide
            _hideunhide()
        Case $msg[0] = $enabledisable
            _enabledisable()
        Case $msg[0] = $prohibitallow
            _prohibitallow()
    EndSelect
EndFunc   ;==>_guiget$msg[0]


Func _getprocesses()
    _LockAndWait()
    _GUICtrlListViewDeleteAllItems($processlist)
    $currentrunningprocesses = ProcessList()
    $i = 0
    Do
        $i = $i + 1
        $priorityverbalized = ""
        $priority = _ProcessGetPriority($currentrunningprocesses[$i][0])
        Select
            Case $priority = -1
                $priorityverbalized = "Not Applicable"
            Case $priority = 0
                $priorityverbalized = "Idle/Low"
            Case $priority = 1
                $priorityverbalized = "Below Normal"
            Case $priority = 2
                $priorityverbalized = "Normal"
            Case $priority = 3
                $priorityverbalized = "Above Normal"
            Case $priority = 4
                $priorityverbalized = "High"
            Case $priority = -1
                $priorityverbalized = "Realtime"
        EndSelect
        GUICtrlCreateListViewItem($currentrunningprocesses[$i][0] & "|" & $currentrunningprocesses[$i][1] & "|" & $priorityverbalized, $processlist)
    Until $i = $currentrunningprocesses[0][0]
    _ResetLockWait()
EndFunc   ;==>_getprocesses

Func _terminate()
    $sel = GUICtrlRead($processlist)
    If $sel <> 0 Then
        $closepid = GUICtrlRead($sel)
        $closepid = StringSplit($closepid, "|")
        $closepid = $closepid[2]
        ProcessClose($closepid)
    EndIf
EndFunc   ;==>_terminate

Func _terminate2()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $closepid = GUICtrlRead($sel)
        $closepid = StringSplit($closepid, "|")
        $closepid = $closepid[1]
        WinKill($closepid)
    EndIf
EndFunc   ;==>_terminate2

Func _LockAndWait()
    GUISetState(@SW_LOCK, $mainwindow)
    GUISetCursor(15, 1)
EndFunc   ;==>_LockAndWait

Func _ResetLockWait()
    GUISetState(@SW_UNLOCK, $mainwindow)
    GUISetCursor(2, 1)
    _ReduceMemory()
EndFunc   ;==>_ResetLockWait

Func _ReduceMemory()
    Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory

Func _getwindows()
    _LockAndWait()
    _GUICtrlListViewDeleteAllItems($windowlist)
    $currentwindows = WinList()
    $i = 0
    Dim $item[$currentwindows[0][0]]
    Do
        $i = $i + 1
        If $currentwindows[$i][0] <> "" Then
            $stateverbalized = ""
            $state = WinGetState($currentwindows[$i][0])
            If BitAND($state, 2) Then
                $stateverbalized = $stateverbalized & "Vis., "
            EndIf
            If Not BitAND($state, 2) Then
                $stateverbalized = $stateverbalized & "Invis., "
            EndIf
            If BitAND($state, 4) Then
                $stateverbalized = $stateverbalized & "Enabl., "
            EndIf
            If Not BitAND($state, 4) Then
                $stateverbalized = $stateverbalized & "Disabl., "
            EndIf
            If BitAND($state, 8) Then
                $stateverbalized = $stateverbalized & "Act., "
            EndIf
            If Not BitAND($state, 8) Then
                $stateverbalized = $stateverbalized & "Inact., "
            EndIf
            If BitAND($state, 16) Then
                $stateverbalized = $stateverbalized & "Min., "
            EndIf
            If BitAND($state, 32) Then
                $stateverbalized = $stateverbalized & "Max., "
            EndIf
            $stateverbalized = StringTrimRight($stateverbalized, 2)
            $pid = WinGetProcess($currentwindows[$i][0])
            GUICtrlCreateListViewItem($currentwindows[$i][0] & "|" & $pid & "|" & $stateverbalized, $windowlist)
        EndIf
    Until $i = $currentwindows[0][0]
    _ResetLockWait()
EndFunc   ;==>_getwindows

Func _close()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $sel = $sel[1]
        WinClose($sel)
        _getwindows()
    EndIf
EndFunc   ;==>_close

Func _activate()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $sel = $sel[1]
        WinActivate($sel)
        _getwindows()
    EndIf
EndFunc   ;==>_activate

Func _min()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $sel = $sel[1]
        WinSetState($sel, "", @SW_MINIMIZE)
        _getwindows()
    EndIf
EndFunc   ;==>_min

Func _maxim()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $sel = $sel[1]
        WinSetState($sel, "", @SW_MAXIMIZE)
        _getwindows()
    EndIf
EndFunc   ;==>_maxim

Func _freemem()
    $sel = GUICtrlRead($processlist)
    If $sel <> 0 Then
        $freepid = GUICtrlRead($sel)
        $freepid = StringSplit($freepid, "|")
        $freepid = $freepid[2]
        _ReduceMemory2($freepid)
    EndIf
EndFunc   ;==>_freemem

Func _ReduceMemory2($i_PID = -1)
    If $i_PID <> - 1 Then
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
    Else
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
    EndIf
    
    Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory2

Func _freemem2()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $sel = $sel[2]
        _ReduceMemory2($sel)
    EndIf
EndFunc   ;==>_freemem2

Func _freeallmem()
    _LockAndWait()
    $currentrunningprocesses = ProcessList()
    $i = 1
    Dim $item[$currentrunningprocesses[0][0]]
    Do
        _ReduceMemory2($currentrunningprocesses[$i][1])
        $i = $i + 1
    Until $i = $currentrunningprocesses[0][0]
    _ResetLockWait()
    _getprocesses()
EndFunc   ;==>_freeallmem

Func _hideunhide()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $selname = $sel[1]
        $selstate = WinGetState($selname)
        If BitAND($selstate, 2) Then
            WinSetState($selname, "", @SW_HIDE)
        Else
            WinSetState($selname, "", @SW_SHOW)
            WinActivate("Marfdaman Process Manager")
        EndIf
        _getwindows()
    EndIf
EndFunc   ;==>_hideunhide

Func _enabledisable()
    $sel = GUICtrlRead($windowlist)
    If $sel <> 0 Then
        $sel = GUICtrlRead($sel)
        $sel = StringSplit($sel, "|")
        $selname = $sel[1]
        $selstate = WinGetState($selname)
        If BitAND($selstate, 4) Then
            WinSetState($selname, "", @SW_DISABLE)
        Else
            WinSetState($selname, "", @SW_ENABLE)
        EndIf
        _getwindows()
    EndIf
EndFunc   ;==>_enabledisable

Func _prohibitallow()
    $sel = GUICtrlRead($processlist)
    If $sel <> 0 Then
        $processname = GUICtrlRead($sel)
        $processname = StringSplit($processname, "|")
        $processname = $processname[1]
        $phbtprgrms = IniReadSectionNames(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini")
        If IsArray($phbtprgrms) Then
            $find = _ArraySearch($phbtprgrms, $processname)
            If $find <> - 1 Then
                IniDelete(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", $processname)
            Else
                IniWrite(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini", $processname, "", "")
            EndIf
        EndIf
    EndIf
EndFunc   ;==>_prohibitallow

Func _checkprocesses()
    $phbtprgrms = IniReadSectionNames(@ProgramFilesDir & "\Marfdaman Process Manager\Settings.ini")
    If IsArray($phbtprgrms) Then
        $i = 1
        For $i = 1 To $phbtprgrms[0]
            ProcessClose($phbtprgrms[$i])
        Next
    EndIf
EndFunc   ;==>_checkprocesses

Func _while()
    Global $msg = GUIGetmsg(1)
    If $msg[0] > 0 Or $msg[0] = $GUI_EVENT_CLOSE Then
        _guigetmsg()
    EndIf
    If $active = 1 And TimerDiff($timer) > 1000 Then
        _checkprocesses()
        $timer = TimerInit()
    EndIf
    If TimerDiff($timer2) > 30000 Then
        _getprocesses()
        _getwindows()
        $timer2 = TimerInit()
    EndIf
EndFunc
Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • Moderators

Undeclared variables.

C:\Program Files\Marfdaman Process Manager\MPM.au3(174,16) : WARNING: $msg: possibly used before declaration.

Case $msg[0]=

~~~~~~~~~~~~~^

C:\Program Files\Marfdaman Process Manager\MPM.au3(175,27) : WARNING: $sel: possibly used before declaration.

$sel = GUICtrlRead($sel)

~~~~~~~~~~~~~~~~~~~~~~~^

C:\Program Files\Marfdaman Process Manager\MPM.au3 - 0 error(s), 2 warning(s)

Edit:

Looks really good though :). Some flickers but you can work those out I'm sure.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Undeclared variables.

Yes that's something you'll see in more of my scripts, I only take the trouble of declaring if can actually lead to any errors, so there's nothing to worry about. It did work in spite of the warnings, didn't it?

Regards

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

very nice :)

but the buttons are ugly :(

Haha lol yeah I know, I didn't like the usual windows buttons so I decided to use my own great artistic feeling...

Tnx for replying!

Regards

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • 3 weeks later...

Thought someone might be interested...you never know...

Anyway here's a screenshot:

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

I'm interested. Looks much better than those lame pics you got on there!

http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script]
Link to comment
Share on other sites

Nice.

thanks.

now it only needs a ico. :D

The exe from my site has an icon for it: http://marfdaman.googlepages.com/MarfdamanProcessManager.exe

@AutoItKing

You mean those Word made pics? Can't say you're wrong about that lol :D

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

  • 2 months later...

Wow, thought this tread had died a cruel death... I'm very sorry to say though that I don't have them anymore myself due to a little reformatting :P Sorry...

Edit: the file from the first post does hoewever contain the soucre and files in a VERY early stage, compared to what it had become before the formatting.

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

yep, same here.

Yes, that looks all too familliar, it has something to do with the FileInstalls. The controls will randomly misplace. I had this issue with some of my other scripts as well, and as soon as the whole fileinstall part is commented out there are no such problems anymore.

:P

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Link to comment
Share on other sites

That is something i've noticed too in a few of my scripts.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...