Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get the index of a focused list item
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.
Finally, I am satisfied with the following, very fast and efficient solution :

Function tempf
Trigger SF8     Help - how to add the trigger to the macro
Copy      Help
for i 0 n
,GetListViewItemText(hwl i &sp)
,,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si si _s
,,mac "Warning_QM" si
,if(SendMessage(hwl LVM_GETITEMSTATE i 0xffff00ff)&LVIS_SELECTED)
,,out "Index found %i" i

Any comment is appreciated
Macro Macro2431
Copy      Help
int w=win("Winamp" "BaseWindow_RootWnd")
int hwl=child("List4" "SysListView32" w 0x0 "id=1001") ;;list 'Refine:'

out i

But it will not work in Windows 7/8 Explorer, it does not use SysListView32.
Excellent !

Many thanks Best regards.

Forum Jump:

Users browsing this thread: 2 Guest(s)