Posts: 1,058
Threads: 367
Joined: Oct 2007
Supposed that an item in a SysListView32 list, for example a line of windows explorer, is focused, for example with a a.Select(SELFLAG_TAKESELECTION) statement. Is there a way, for example with a SendMessage command, to get the index of this list item. I understand that it can be done with a loop of GetListViewItemText statements but if the list is long it takes considerable time ! Any advice is welcome. Thanks in advance.
Posts: 1,058
Threads: 367
Joined: Oct 2007
Finally, I am satisfied with the following, very fast and efficient solution :
Function
tempf
Trigger
SF8
for i 0 n
,GetListViewItemText(hwl i &sp)
,err
,,_s=_error.description
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,,mac "Warning_QM" si
,,end
,if(SendMessage(hwl LVM_GETITEMSTATE i 0xffff00ff)&LVIS_SELECTED)
,,out "Index found %i" i
,,break
Any comment is appreciated
Posts: 12,066
Threads: 140
Joined: Dec 2002
Macro
Macro2431
int w=win("Winamp" "BaseWindow_RootWnd")
int hwl=child("List4" "SysListView32" w 0x0 "id=1001") ;;list 'Refine:'
int i=SendMessage(hwl LVM_GETNEXTITEM -1 LVNI_SELECTED) ;;or LVNI_FOCUSED, or LVNI_SELECTED|LVNI_FOCUSED
out i
But it will not work in Windows 7/8 Explorer, it does not use SysListView32.
Posts: 1,058
Threads: 367
Joined: Oct 2007
Excellent !
Many thanks Best regards.