Jump to content

ProcessList and list


Recommended Posts

#include <GUIConstants.au3>
$processes = ProcessList("processes")
$Form1 = GUICreate("AForm1", 380, 470, 192, 125)
GUICtrlCreateLabel("process lister", 8, 16, 370, 17)
$List1 = GUICtrlCreateList("", 40, 64, 297, 305, -1, $WS_EX_CLIENTEDGE)
$ListRefresh = GUICtrlCreateButton("List/Refresh", 80, 408, 241, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $listrefresh
        GUICtrlSetData($List1, $processes)
    EndSelect
WEnd
Exit

Hmm... the list says nothing even after i click the button. Is it just these commands don't go togeather? or did i mess up :D

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 380, 470, 192, 125)
GUICtrlCreateLabel("process lister", 8, 16, 370, 17)
$List1 = GUICtrlCreateList("", 40, 64, 297, 305, -1, $WS_EX_CLIENTEDGE)
$ListRefresh = GUICtrlCreateButton("List/Refresh", 80, 408, 241, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $ListRefresh
            PList()
    EndSelect
WEnd
Exit

Func PList()
    $processes = ProcessList()
    For $i = 1 To $processes[0][0]
        GUICtrlSetData($List1, $processes[$i][0], 1)
    Next
EndFunc  ;==>PList

8)

NEWHeader1.png

Link to comment
Share on other sites

Ok, i have another question, is it possible to end a process that is highlighted? I guess you would have to find out which process is highlighted. Can someone tell me the functions i should look at (other that processclose?)

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 380, 470, 192, 125)
GUICtrlCreateLabel("process lister", 8, 16, 370, 17)
$List1 = GUICtrlCreateList("", 40, 64, 297, 305, -1, $WS_EX_CLIENTEDGE)
$ListRefresh = GUICtrlCreateButton("List/Refresh", 40, 408, 150, 41)
$Pclose = GUICtrlCreateButton("Close Process", 200, 408, 150, 41)
GUISetState(@SW_SHOW)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $ListRefresh
            PList()
        Case $msg = $Pclose
            ProcessClose(GUICtrlRead($List1))
            PList()
    EndSelect
WEnd
Exit

Func PList()
    $processes = ProcessList()
    For $i = 1 To $processes[0][0]
        GUICtrlSetData($List1, $processes[$i][0], 1)
    Next
EndFunc  ;==>PList

8)

NEWHeader1.png

Link to comment
Share on other sites

Oh, i didn't know it was that. Anyway thanks.

EDIT: Ok, it works mostly, but when i close a process, it closes, but still appears as open, even if i click refresh.

Edited by codemyster
Link to comment
Share on other sites

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...