Jump to content

Help the script Get Window


Gee
 Share

Recommended Posts

HI. all

my question : how do script remove ListViewItem when I close Window and Item not loop ?

GUICreate("", 300, 200)
$ListView = GUICtrlCreateListView("Name | State", 10, 10, 280, 180)
AdlibEnable("_GetWin", 1000)
GUISetState()

While 1
$MSG = GUIGetMsg()
Switch ($MSG)
       Case $GUI_EVENT_CLOSE
       Exit
EndSwitch
WEnd

;=============
Func _GetWin()
    Global $Array[1]
    $Array[0]= 0
    $Win = WinList()
    For $i= 1 To $Win[0][0]
        If $Win[$i][0] <> "" And _Visible($Win[$i][0], 2) = 1 Then
            _ArrayAdd($Array, $Win[$i][0])
            $Str = StringInStr($Win[$i][0], "C")
            If $Str <> 0  Then
            GUICtrlCreateListViewItem($Win[$i][0]& "| C", $ListView)
        Else
            GUICtrlCreateListViewItem($Win[$i][0], $ListView)
            EndIf
        
        EndIf
        Next
EndFunc
    
Func _Visible($hwnd, $State)
    $visible =  WinGetState($hwnd)
    If BitAND($visible, $State) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

post-41138-1224139227_thumb.jpg

Edited by Gee
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <Array.au3>

GUICreate("", 300, 200)
$ListView = GUICtrlCreateListView("Name    | State", 10, 10, 280, 180)
AdlibEnable("_GetWin", 1000)
GUISetState()

While 1
$MSG = GUIGetMsg()
Switch ($MSG)
       Case $GUI_EVENT_CLOSE
       Exit
EndSwitch
WEnd

;=============
Func _GetWin()
    Global $Array[1]
    $Array[0]= 0
    $Win = WinList()
    GuiCtrlSendMsg($ListView,0x1009,0,0) ;CLEARS THE LISTVIEW EACH TIME IT IS RUN
    For $i= 1 To $Win[0][0]
        If $Win[$i][0] <> "" And _Visible($Win[$i][0], 2) = 1 Then
            _ArrayAdd($Array, $Win[$i][0])
            $Str = StringInStr($Win[$i][0], "C")
            If $Str <> 0  Then
            GUICtrlCreateListViewItem($Win[$i][0]& "| C", $ListView)
        Else
            GUICtrlCreateListViewItem($Win[$i][0], $ListView)
            EndIf
        
        EndIf
        Next
EndFunc
    
Func _Visible($hwnd, $State)
    $visible =  WinGetState($hwnd)
    If BitAND($visible, $State) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Added one line:

GuiCtrlSendMsg($ListView,0x1009,0,0)

- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!
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...