Jump to content

i have created a Custom Mini Task Manager but it shows some unwanted titles can someone recognize what line is causing this


Recommended Posts

i wanted to create  a Custom Mini Task Manager that works the same as windows 8 task manager when you click fewer details . and the problem is that at first it shows the names of the applications normally but after i click on it or open some other application it start redoubling or showing other applications that are already closed .

#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
Example()
Func Example()
Global $hImage,$exeimage, $aSize, $idListview
    GUICreate("MY Task Manager", 500, 300)
    Global $pList = ProcessList()
while 1
Global $mt1 = 0
Global $mt2 = 0
Bmonitask()
if $mt1 <> $mt2 then
sleep (200)
reftask ()
EndIf
WEnd
        While 2
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $proMenuP1
            winkill ($wtoend)
            EndSwitch
    WEnd
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example


func reftask ()
   Global $aList = WinList()
$idListview = GUICtrlCreateListView("", 2, 2, 494, 294, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($idListview, "Name", 460)
$hImage = _GUIImageList_Create(32, 32, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4, True)
    For $i = 1 To $aList[0][0]
if WinGetState($aList[$i][0]) = 15 then
if not $aList[$i][0]  ="" then
$ProcessName = GUICtrlCreateListViewItem($aList[$i][0] &"", $idListview)
$ProcessNameMenu = GUICtrlCreateContextMenu($ProcessName)
$proMenuP1 = GUICtrlCreateMenuItem("Kill process", $ProcessNameMenu)
EndIf
EndIf
if WinGetState($aList[$i][0]) = 7 then
if not $aList[$i][0]  ="" then
$ProcessName = GUICtrlCreateListViewItem($aList[$i][0] &"", $idListview)
$ProcessNameMenu = GUICtrlCreateContextMenu($ProcessName)
$proMenuP1 = GUICtrlCreateMenuItem("Kill process", $ProcessNameMenu)
EndIf
EndIf
if WinGetState($aList[$i][0]) = 23 then
if not $aList[$i][0]  ="" then
$ProcessName = GUICtrlCreateListViewItem($aList[$i][0] &"", $idListview)
$ProcessNameMenu = GUICtrlCreateContextMenu($ProcessName)
$proMenuP1 = GUICtrlCreateMenuItem("Kill process", $ProcessNameMenu)
EndIf
EndIf
$wtoend = $aList[$i][1]
     Next
  EndFunc


func Bmonitask()
    Global $Bmon = WinList()
    For $b = 1 To $Bmon[0][0]
if WinGetState($Bmon[$b][0]) = 15 then
if not $Bmon[$b][0]  ="" then
$mt1 = $mt1 + 1
EndIf
EndIf
if WinGetState($Bmon[$b][0]) = 7 then
if not $Bmon[$b][0]  ="" then
$mt1 = $mt1 + 1
EndIf
EndIf
     Next
     sleep (500)
     Global $Bmon2 = WinList()
        For $b2 = 1 To $Bmon2[0][0]
if WinGetState($Bmon2[$b2][0]) = 15 then
if not $Bmon2[$b2][0]  ="" then
$mt2 = $mt2 + 1
EndIf
EndIf
if WinGetState($Bmon2[$b2][0]) = 7 then
if not $Bmon2[$b2][0]  ="" then
$mt2 = $mt2 + 1
EndIf
EndIf
     Next
EndFunc

 

Link to comment
Share on other sites

whats up  @AutoBert i didnt understand anyything you said :blink: . 

12 hours ago, AutoBert said:
  1. Have a look at example for _GUICtrlListView_Create
  2. Delete killed process from ListView

 

 1. ok ... am looking there but i can't seem to find anything that might help me

2. what do you mean by Delete killed process from ListView . are you talking about the GUICtrlCreateMenuItem or do you mean to create a function that do so ...

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