0

Is it possible to obtain the position of a shell folder item -- in Explorer's details view -- without using IFolderView::GetItemPosition? I've tried IFolderView::GetItemPosition on both Windows 8.1 and 10, and it seems to just return E_NOTIMPL. Are there other ways to go about it?

I've considered using the index of the shell item and multiplying that by the height of a listview item. But if the files are displayed using "group by," for example, then there won't be a reliable correspondence between the index and the vertical position.

  • UIAutomation could probaby be used for this. – Jonathan Potter Feb 18 '20 at 20:13
  • Thanks. Well I've looked into that, but I don't think there's a reliable way to logically connect the UIAutomation elements to the shell items they represent. I've used Inspect, and it appears that a file UIAutomation element may have a "name" attribute reflecting the file name in the UI. But for example, if the user is not showing file extensions, then it would be unclear what file that name represents. But maybe I'm wrong. Do you have any further input? –  Feb 18 '20 at 20:21
  • Can you share the reason that you not use `IFolderView::GetItemPosition`? I saw a similar [post](https://stackoverflow.com/questions/56517086/ifolderviewgetitemposition-returns-e-notimpl) before, and it seems you asked, like I said, if you can provide code that can reproduce the problem, I will be glad to help you solve it. – Strive Sun Feb 19 '20 at 08:05
  • I do reproduce the E_NOTIMPL. It just works for desktop (as in Chen's sample). I guess this IFolderView::GetItemPosition interface (and associate SelectAndPositionItems) are just optional (not all methods of a COM interface must do something, sometimes it's valid to return E_NOTIMPL - well, here, it's not documented but documentation on these is sparse). If someone implements IFolderView he can choose to implement them or not. Explorer shell windows just don't. – Simon Mourier Feb 19 '20 at 08:14
  • Do you think LVM_GETITEMPOSITION might be an option? Maybe if you get the index of the item in the folder view, you could then send that index with LVM_GETITEMPOSITION? I can't tell if that is affected by groups or not. –  Mar 06 '20 at 19:01

0 Answers0