Sign in to follow this  
Followers 0
GianAutoitprogrammer

How to list opened applications using winlist()

3 posts in this topic

Hellow

how to list all opened programs using WinList() using a ListView item and select a program to WinKill() the selected program

Mycode to list all visible programs

GUICtrlDelete($List)   
$List = GUICtrlCreateList("", 0, 40, 409, 214)
      $var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])
    GUICtrlSetData($List, $var[$i][0])
    
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

I dont know how to select a program and kill it...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your code kind of makes sense, but it lists things that are not processes (such as AutoIt's help file, which is a CHM file).

Not sure if this will be of help to you, but I just wrote this little ditty. It seems more like what you describe what you want to do.

#include <array.au3>
$list = ProcessList()
for $i = 1 to $list[0][0]
next

_ArrayDisplay($list)

$ans = InputBox("Terminate a process", "Enter the line number of the process you want to kill.")
ProcessClose($list[$ans][0])
Edited by sleepydvdr

#include <ByteMe.au3>

Share this post


Link to post
Share on other sites

I am building some kind of a backup task manager

you can see the code in the task manager > Applications tab

see the attachment below... anyway tnx for your code, your code will list all processes that are running...

1.bmp

Share this post


Link to post
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
Sign in to follow this  
Followers 0