Check for the LVN_ITEMCHANGED ListView Notifications code and call LV.GetCount("S") (same as send the LVM_GETSELECTEDCOUNT Message to the ListView control)
Code: Select all
MyGui := Gui()
LV := MyGui.Add("ListView", "w300 r8 Grid -LV0x10", ["Column1", "Column2", "Column3"])
loop 7
LV.Add(, A_Index * 1, A_Index * 2, A_Index * 3)
LV.OnNotify(LVN_ITEMCHANGED := -101, LV_CountSelectedItems)
MyGui.Show()
LV_CountSelectedItems(LV, *)
{
MyGui.Title := "[" LV.GetCount("S") " / " LV.GetCount() "]"
}
/*
LVM_GETSELECTEDCOUNT(handle) ; same as LV.GetCount("S")
{
static LVM_FIRST := 0x1000
static LVM_GETSELECTEDCOUNT := LVM_FIRST + 50
return SendMessage(LVM_GETSELECTEDCOUNT, 0, 0, handle)
}
*/
Works also with selecting by SHIFT + ARROW or CTRL + ARROW and ContextMenu with LV.Modify(0, "Select")