Page 1 of 1

Questions about ExplorerListGadget

Posted: Fri Jul 01, 2005 3:20 pm
by TerryHough
First, a bit of code as an example:

Code: Select all

; Based on example by freak

#LVM_SETEXTENDEDLISTVIEWSTYLE = #LVM_FIRST + 54
#LVS_EX_CHECKBOXES = 4

#ExpListG = 0
#ButtonG1 = 1

If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"File Selection") And CreateGadgetList(WindowID(0))
  ButtonGadget(#ButtonG1, 180, 220, 80, 20, "Process")
  ; Set flags for the Explorer List
  Flag = #PB_Explorer_MultiSelect|#PB_Explorer_NoParentFolder|#PB_Explorer_AutoSort|#PB_Explorer_NoFolders
  ExplorerListGadget(#ExpListG, 10, 10, 380, 180, "\purebasic\examples\sources\*.PB", Flag)
  ; Change to List format
  ChangeListIconGadgetDisplay(#ExpListG, 2)
  ; Remove unwanted columns
  RemoveGadgetColumn(#ExpListG, 3)
  RemoveGadgetColumn(#ExpListG, 2)
  RemoveGadgetColumn(#ExpListG, 1)
  ; Enable Checkboxes in the ExplorerListGadget
  SendMessage_(GadgetID(#ExpListG), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_CHECKBOXES, #LVS_EX_CHECKBOXES)

  Repeat
    Event = WaitWindowEvent()
    If Event = #PB_EventGadget And EventGadgetID() = #ButtonG1
      Count = SendMessage_(GadgetID(#ExpListG), #LVM_GETSELECTEDCOUNT, 0, 0)
      ; MessageRequester("Debug","The number of file selected: " + Str(count),0)
      ; Loop through all displayed items
      For I = 0 To CountGadgetItems(#ExpListG) - 1
        State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, I, #LVIS_STATEIMAGEMASK)
        If State >> 12 > 1
          ; The checkbox is checked, do processing here
          MessageRequester("Debug","Process this file: " + GetGadgetItemText(#ExpListG, I, 0),0)
          ; Uncheck the box
          State = SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, I, #LVIS_STATEIMAGEMASK)
        EndIf
      Next I
    EndIf
  Until Event = #PB_Event_CloseWindow
EndIf
Question #1 - How can I eliminate the little icon from each line?

Question #2 - Is there any way to eliminate the filename extension?

Question #3 - When the checkbox is checked, how can I set the item to be selected similar to how

Code: Select all

SetGadgetItemState(gadget, item, #PB_ListIcon_Selected) 
works for the ListIconGadget?

Question #4 - How can I put a checkmark in every check box?

Thanks for your help
Terry

Posted: Sat Jul 02, 2005 3:39 am
by Sparkie
I'm sure freak will have a little better knowledge of the inner workings of the ExplorerListGadget than I , but here's what I came up with for you Terry. It could probably use a little fine tuning, but it should get you pointed in the right direction. ;)

#1 is handled with line 60 :RemoveIcons(#ExpListG) which is the RemoveIcons() Procedure (Lines 10 - 18 )

#2 is handled with line 62: RemoveExt(#ExpListG) which is the RemoveExt() Procedure (Lines 20 - 27)

#3 is handled with lines 93 - 113. (I was hoping to catch #WM_NOTIFY messages to handle this, but no luck. :( )

#4 (Check all) is handled with line 68: CheckAll(#ExpListG) which is the CheckAll() Procedure (Lines 29 - 35)
#4 (Uncheck all) is handled with line 71: UnCheckAll(#ExpListG) which is the CheckAll() Procedure (Lines 37 - 43)

Code: Select all

; Based on example by freak 

#LVM_SETEXTENDEDLISTVIEWSTYLE = #LVM_FIRST + 54 
#LVS_EX_CHECKBOXES = 4 

#ExpListG = 0 
#ButtonG1 = 1 
#ButtonG2 = 2 

Procedure RemoveIcons(gad) 
  ;--> To remove the icons, we make a duplicate the current ImageList for the small icons 
  hIList = SendMessage_(GadgetID(#ExpListG), #LVM_GETIMAGELIST, #LVSIL_SMALL, 0) 
  hImageList = ImageList_Duplicate_(hIList)
  ;--> When we resize the icons, they all are removed 
  ;--> I will resize the ImageList icons to a width of 1 and height of 16 
  ImageList_SetIconSize_(hImageList, 1, 16) 
  ;--> Send the new ImageList to the ExplorerListGadget 
  SendMessage_(GadgetID(#ExpListG), #LVM_SETIMAGELIST, #LVSIL_SMALL, hImageList) 
  ProcedureReturn hImageList
EndProcedure 

Procedure RemoveExt(gad) 
  ;--> Remove file extension 
  For i = 0 To CountGadgetItems(gad) - 1 
    t$ = GetGadgetItemText(gad, i, 0) 
    dot = FindString(t$, ".", 1) - 1 
    SetGadgetItemText(gad, i, Left(t$, dot), 0) 
  Next i 
EndProcedure 

Procedure CheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK  | #LVIS_SELECTED 
  eItem\State = 8194 ; 0010 0000 00000010 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

Procedure UnCheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
  eItem\State = 4096 ; 0001 0000 00000000 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"File Selection") And CreateGadgetList(WindowID(0)) 
  ButtonGadget(#ButtonG2, 10, 220, 100, 20, "Check All") 
  ButtonGadget(#ButtonG1, 180, 220, 80, 20, "Process") 
  ; Set flags for the Explorer List 
  Flag = #PB_Explorer_AlwaysShowSelection | #PB_Explorer_MultiSelect | #PB_Explorer_NoParentFolder | #PB_Explorer_AutoSort | #PB_Explorer_NoFolders 
  ExplorerListGadget(#ExpListG, 10, 10, 380, 180, "\purebasic\examples\sources\*.PB", Flag) 
  ; Change to List format 
  ChangeListIconGadgetDisplay(#ExpListG, 2) 
  ; Remove unwanted columns 
  RemoveGadgetColumn(#ExpListG, 3) 
  RemoveGadgetColumn(#ExpListG, 2) 
  RemoveGadgetColumn(#ExpListG, 1) 
  ; Enable Checkboxes in the ExplorerListGadget 
  SendMessage_(GadgetID(#ExpListG), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_CHECKBOXES, #LVS_EX_CHECKBOXES) 
  ;--> Remove Icons 
  dupImageList = RemoveIcons(#ExpListG) 
  ;--> Remove file extension 
  RemoveExt(#ExpListG) 
  Repeat 
    event = WaitWindowEvent() 
    If event = #PB_EventGadget And EventGadgetID() = #ButtonG2 
      Select GetGadgetText(2) 
        Case "Check All" 
          CheckAll(#ExpListG) 
          SetGadgetText(2, "Uncheck All") 
        Case "Uncheck All" 
          UnCheckAll(#ExpListG) 
          SetGadgetText(2, "Check All") 
      EndSelect 
    EndIf 
    If event = #PB_EventGadget And EventGadgetID() = #ButtonG1 
      Count = SendMessage_(GadgetID(#ExpListG), #LVM_GETSELECTEDCOUNT, 0, 0) 
      ; MessageRequester("Debug","The number of file selected: " + Str(count),0) 
      ; Loop through all displayed items 
      For i = 0 To CountGadgetItems(#ExpListG) - 1 
        State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, i, #LVIS_STATEIMAGEMASK) 
        If State >> 12 > 1 
          ; The checkbox is checked, do processing here 
          MessageRequester("Debug","Process this file: " + GetGadgetItemText(#ExpListG, i, 0),0) 
          ; Uncheck the box 
          eItem.LV_ITEM 
          eItem\mask = #LVIF_STATE 
          eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
          eItem\State = 4096 ; 0001 0000 00000000 
          State = SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, i, eItem) 
        EndIf 
      Next i 
    EndIf 
    ;--> Sync check/select and nocheck/unselect 
    If event = #PB_EventGadget And EventGadgetID() = #ExpListG And EventType() = #PB_EventType_Change 
      For i = 0 To CountGadgetItems(#ExpListG) -1 
        State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, i, #LVIS_STATEIMAGEMASK) 
        If State = 8192 
          ;--> Checked so select 
          eItem.LV_ITEM 
          eItem\mask = #LVIF_STATE 
          eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
          eItem\State = 8194 
          SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, i, eItem) 
        ElseIf State = 4096 
          ;--> No check, unselect 
          eItem.LV_ITEM 
          eItem\mask = #LVIF_STATE 
          eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
          eItem\State = 4096 
          SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, i, eItem) 
        EndIf 
      Next i 
    EndIf 
  Until event = #PB_Event_CloseWindow 
  ;--> Clean up
  ImageList_Destroy_(dupImageList)
EndIf 
*Edited to change ImageList procedure as suggested by freak

Posted: Sat Jul 02, 2005 1:30 pm
by freak
Sparkie:

About the Icons:
You must be carefull when making changes to that imagelist. It is a
system imagelist (ie not created by me). I do not know what effects such changes
can have on other programs, or even windows itself.

The better solution is to dublicate the imagelist, make the changes there,
and set the new imagelist for the gadget.

About the #WM_NOTIFY:
You have to subclass the direct parent window of the gadget: GetParent_(GadgetID...)) .
It is a static window used for the messages processing.

Posted: Sat Jul 02, 2005 2:43 pm
by Sparkie
Thanks freak, I appreciate the help and suggestions. :) I've changed the ImageList procedure above as you suggested. Now I'll go on to the subclassing for #WM_NOTIFY. ;)

Posted: Sat Jul 02, 2005 3:00 pm
by Sparkie
Thanks again to freak for his assistance. :)

Here's the tuned up code.

#3 is now handled with the subclass procedure, ExListCallback(), in lines 12 - 39. This way we don't have to loop through all items when there is a change. 8)

Code: Select all

; Based on example by freak 

#LVM_SETEXTENDEDLISTVIEWSTYLE = #LVM_FIRST + 54 
#LVS_EX_CHECKBOXES = 4 

#ExpListG = 0 
#ButtonG1 = 1 
#ButtonG2 = 2 

Global oldCallback

Procedure ExListCallback(hwnd, msg, wparam, lparam)
  result = CallWindowProc_(oldCallback, hwnd, msg, wparam, lparam)
  Select msg
    Case #WM_NOTIFY
      *pNMHDR.NMHDR = lparam
      Select *pNMHDR\code
        Case #LVN_ITEMCHANGED
          *pNML.NMLISTVIEW = lparam
          State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, *pNML\iItem, #LVIS_STATEIMAGEMASK) 
          If State = 8192 
            ;--> Checked so select 
            eItem.LV_ITEM 
            eItem\mask = #LVIF_STATE 
            eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
            eItem\State = 8194 
            SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, *pNML\iItem, eItem) 
          ElseIf State = 4096 
            ;--> No check, unselect 
            eItem.LV_ITEM 
            eItem\mask = #LVIF_STATE 
            eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
            eItem\State = 4096 
            SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, *pNML\iItem, eItem) 
          EndIf
      EndSelect
  EndSelect
  ProcedureReturn result
EndProcedure

Procedure RemoveIcons(gad) 
  ;--> To remove the icons, we make a duplicate the current ImageList for the small icons 
  hIList = SendMessage_(GadgetID(#ExpListG), #LVM_GETIMAGELIST, #LVSIL_SMALL, 0) 
  hImageList = ImageList_Duplicate_(hIList) 
  ;--> When we resize the icons, they all are removed 
  ;--> I will resize the ImageList icons to a width of 1 and height of 16 
  ImageList_SetIconSize_(hImageList, 1, 16) 
  ;--> Send the new ImageList to the ExplorerListGadget 
  SendMessage_(GadgetID(#ExpListG), #LVM_SETIMAGELIST, #LVSIL_SMALL, hImageList) 
  ProcedureReturn hImageList 
EndProcedure 

Procedure RemoveExt(gad) 
  ;--> Remove file extension 
  For i = 0 To CountGadgetItems(gad) - 1 
    t$ = GetGadgetItemText(gad, i, 0) 
    dot = FindString(t$, ".", 1) - 1 
    SetGadgetItemText(gad, i, Left(t$, dot), 0) 
  Next i 
EndProcedure 

Procedure CheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK  | #LVIS_SELECTED 
  eItem\State = 8194 ; 0010 0000 00000010 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

Procedure UnCheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
  eItem\State = 4096 ; 0001 0000 00000000 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

If OpenWindow(0,0,0,400,300,#PB_Window_SystemMenu | #PB_Window_ScreenCentered, "File Selection") And CreateGadgetList(WindowID(0)) 
  ButtonGadget(#ButtonG2, 10, 220, 100, 20, "Check All") 
  ButtonGadget(#ButtonG1, 180, 220, 80, 20, "Process") 
  ; Set flags for the Explorer List 
  Flag = #PB_Explorer_AlwaysShowSelection | #PB_Explorer_MultiSelect | #PB_Explorer_NoParentFolder | #PB_Explorer_AutoSort | #PB_Explorer_NoFolders 
  ExplorerListGadget(#ExpListG, 10, 10, 380, 180, "\purebasic\examples\sources\*.PB", Flag) 
  ; Change to List format 
  ChangeListIconGadgetDisplay(#ExpListG, 2) 
  ; Remove unwanted columns 
  RemoveGadgetColumn(#ExpListG, 3) 
  RemoveGadgetColumn(#ExpListG, 2) 
  RemoveGadgetColumn(#ExpListG, 1) 
  ; Enable Checkboxes in the ExplorerListGadget 
  SendMessage_(GadgetID(#ExpListG), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_CHECKBOXES, #LVS_EX_CHECKBOXES) 
  ;--> Remove Icons 
  dupImageList = RemoveIcons(#ExpListG) 
  ;--> Remove file extension 
  RemoveExt(#ExpListG) 
  hExListParent = GetParent_(GadgetID(#ExpListG))
  oldCallback = SetWindowLong_(hExListParent, #GWL_WNDPROC, @ExListCallback()) 
  Repeat 
    event = WaitWindowEvent() 
    If event = #PB_EventGadget And EventGadgetID() = #ButtonG2 
      Select GetGadgetText(2) 
        Case "Check All" 
          CheckAll(#ExpListG) 
          SetGadgetText(2, "Uncheck All") 
        Case "Uncheck All" 
          UnCheckAll(#ExpListG) 
          SetGadgetText(2, "Check All") 
      EndSelect 
    EndIf 
    If event = #PB_EventGadget And EventGadgetID() = #ButtonG1 
      Count = SendMessage_(GadgetID(#ExpListG), #LVM_GETSELECTEDCOUNT, 0, 0) 
      ; MessageRequester("Debug","The number of file selected: " + Str(count),0) 
      ; Loop through all displayed items 
      For i = 0 To CountGadgetItems(#ExpListG) - 1 
        State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, i, #LVIS_STATEIMAGEMASK) 
        If State >> 12 > 1 
          ; The checkbox is checked, do processing here 
          MessageRequester("Debug","Process this file: " + GetGadgetItemText(#ExpListG, i, 0),0) 
          ; Uncheck the box 
          eItem.LV_ITEM 
          eItem\mask = #LVIF_STATE 
          eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
          eItem\State = 4096 ; 0001 0000 00000000 
          State = SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, i, eItem) 
        EndIf 
      Next i 
    EndIf 
  Until event = #PB_Event_CloseWindow 
  ;--> Clean up 
  ImageList_Destroy_(dupImageList) 
EndIf 

Posted: Wed Jul 06, 2005 4:26 pm
by TerryHough
Thanks Sparkie and freak.

I am away for a few days. Can't wait to get back to study and try your
suggestions.

Thanks,
Terry

Re: Questions about ExplorerListGadget

Posted: Mon Jun 04, 2012 3:36 pm
by SeregaZ
little up theme :)

4.30pb:

Code: Select all

; Based on example by freak 

#LVM_SETEXTENDEDLISTVIEWSTYLE = #LVM_FIRST + 54 
#LVS_EX_CHECKBOXES = 4 

#ExpListG = 0 
#ButtonG1 = 1 
#ButtonG2 = 2 

Global oldCallback

Procedure ExListCallback(hwnd, msg, wparam, lparam)
  result = CallWindowProc_(oldCallback, hwnd, msg, wparam, lparam)
  Select msg
    Case #WM_NOTIFY
      *pNMHDR.NMHDR = lparam
      Select *pNMHDR\code
        Case #LVN_ITEMCHANGED
          *pNML.NMLISTVIEW = lparam
          State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, *pNML\iItem, #LVIS_STATEIMAGEMASK) 
          If State = 8192 
            ;--> Checked so select 
            eItem.LV_ITEM 
            eItem\mask = #LVIF_STATE 
            eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
            eItem\State = 8194 
            SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, *pNML\iItem, eItem) 
          ElseIf State = 4096 
            ;--> No check, unselect 
            eItem.LV_ITEM 
            eItem\mask = #LVIF_STATE 
            eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED 
            eItem\State = 4096 
            SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, *pNML\iItem, eItem) 
          EndIf
      EndSelect
  EndSelect
  ProcedureReturn result
EndProcedure

Procedure RemoveIcons(gad) 
  ;--> To remove the icons, we make a duplicate the current ImageList for the small icons 
  hIList = SendMessage_(GadgetID(#ExpListG), #LVM_GETIMAGELIST, #LVSIL_SMALL, 0) 
  hImageList = ImageList_Duplicate_(hIList) 
  ;--> When we resize the icons, they all are removed 
  ;--> I will resize the ImageList icons to a width of 1 and height of 16 
  ImageList_SetIconSize_(hImageList, 1, 16) 
  ;--> Send the new ImageList to the ExplorerListGadget 
  SendMessage_(GadgetID(#ExpListG), #LVM_SETIMAGELIST, #LVSIL_SMALL, hImageList) 
  ProcedureReturn hImageList 
EndProcedure 

Procedure RemoveExt(gad) 
  ;--> Remove file extension 
  For i = 0 To CountGadgetItems(gad) - 1 
    t$ = GetGadgetItemText(gad, i, 0) 
    dot = FindString(t$, ".", 1) - 1 
    SetGadgetItemText(gad, i, Left(t$, dot), 0) 
  Next i 
EndProcedure 

Procedure CheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK  | #LVIS_SELECTED 
  eItem\State = 8194 ; 0010 0000 00000010 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

Procedure UnCheckAll(gad) 
  eItem.LV_ITEM 
  eItem\mask = #LVIF_STATE 
  eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
  eItem\State = 4096 ; 0001 0000 00000000 
  SendMessage_(GadgetID(gad), #LVM_SETITEMSTATE, -1, eItem) 
EndProcedure 

If OpenWindow(0,0,0,400,300, "File Selection", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) ;And CreateGadgetList(WindowID(0)) 
  ButtonGadget(#ButtonG2, 10, 220, 100, 20, "Check All") 
  ButtonGadget(#ButtonG1, 180, 220, 80, 20, "Process") 
  ; Set flags for the Explorer List 
  ;Flag = #PB_Explorer_AlwaysShowSelection | #PB_Explorer_MultiSelect | #PB_Explorer_NoParentFolder | #PB_Explorer_AutoSort | #PB_Explorer_NoFolders 
  Flag = #PB_Explorer_MultiSelect
  ExplorerListGadget(#ExpListG, 10, 10, 380, 180, "*.*", Flag) 
  ; Change to List format 
  ;;;ChangeListIconGadgetDisplay(#ExpListG, 2) 
  ; Remove unwanted columns 
 ;RemoveGadgetColumn(#ExpListG, 3) 
 ;RemoveGadgetColumn(#ExpListG, 2) 
 ;RemoveGadgetColumn(#ExpListG, 1) 
  ; Enable Checkboxes in the ExplorerListGadget 
 SendMessage_(GadgetID(#ExpListG), #LVM_SETEXTENDEDLISTVIEWSTYLE, #LVS_EX_CHECKBOXES, #LVS_EX_CHECKBOXES) 
  ;--> Remove Icons 
 dupImageList = RemoveIcons(#ExpListG) 
  ;--> Remove file extension 
 ;RemoveExt(#ExpListG) 
 hExListParent = GetParent_(GadgetID(#ExpListG))
 oldCallback = SetWindowLong_(hExListParent, #GWL_WNDPROC, @ExListCallback()) 
  Repeat 
    
     Event = WaitWindowEvent()
       
        Select Event 
    
           Case #PB_Event_Gadget
          
              Select EventGadget() 
                 Case #ButtonG2 
                    Select GetGadgetText(2) 
                       Case "Check All" 
                           CheckAll(#ExpListG) 
                           SetGadgetText(2, "Uncheck All") 
                       Case "Uncheck All" 
                           UnCheckAll(#ExpListG) 
                           SetGadgetText(2, "Check All") 
                    EndSelect 

                 Case  #ButtonG1 
                    Count = SendMessage_(GadgetID(#ExpListG), #LVM_GETSELECTEDCOUNT, 0, 0) 
      ; MessageRequester("Debug","The number of file selected: " + Str(count),0) 
      ; Loop through all displayed items 
                    For i = 0 To CountGadgetItems(#ExpListG) - 1 
                       State = SendMessage_(GadgetID(#ExpListG), #LVM_GETITEMSTATE, i, #LVIS_STATEIMAGEMASK) 
                       If State >> 12 > 1 
          ; The checkbox is checked, do processing here 
                            MessageRequester("Debug","Process this file: " + GetGadgetItemText(#ExpListG, i, 0),0) 
          ; Uncheck the box 
                            eItem.LV_ITEM 
                            eItem\mask = #LVIF_STATE 
                            eItem\stateMask = #LVIS_STATEIMAGEMASK | #LVIS_SELECTED  
                            eItem\State = 4096 ; 0001 0000 00000000 
                            State = SendMessage_(GadgetID(#ExpListG), #LVM_SETITEMSTATE, i, eItem) 
                       EndIf 
                    Next i 
              EndSelect 
              
          EndSelect

 
  Until Event = #PB_Event_CloseWindow 
  ;--> Clean up 
  ImageList_Destroy_(dupImageList) 
EndIf