sharpshell
sharpshell copied to clipboard
Getting current IShellView from SharpDropHandler
Hello, I am changing filenames with SharpDropHandler. But Explorer does not sort the files until I refresh with F5, so it is hard for the user to notice the change.
Is there any way to get a handle of the current IShellView in SharpDropHandler::Drop? I would like to call this method IShellView::Refresh to refresh the view and maybe even IShellView::SelectItem to select the changed files.
Sorry if weird or impossible question. 😅
Looks like you need to copy-paste reimplement SharpDropHandler with some additional interfaces.
I also had to fork the entire project because SharpShell.Attributes.ServerTypeAttribute class needed by the handler is marked internal so I had to change it to be public. 😩 The project is very easy to develop and build though so can't complain. 👍
@windowsdeveloperwannabe mind if I re-open? I'd like to fix this in the mainline! Or if you can share a PR that'd be great :) PS glad you found the project easy to build, I've tried to make it as straightforward as possible to allow people to get it running locally!
@windowsdeveloperwannabe hi, did you implement the refresh function? if yes? could you please share your approch.
hello, is this issue fixed or have any other workaround?
@taiyangluoshan88
Hello,
I'm afraid IShellView::Refresh is a way too expensive of an operation for your problem. When I got it working it took a subsecond to refresh the Explorer view. Somehow Refresh is totally different from a simple F5 in your explorer, so I couldn't use it for my problem either.
I'm currently trying out more shell extension interfaces in regular C++ (just got finished with the boilerplate :sweat_smile:). If do find something to solve your problem I'll send a message. :slightly_smiling_face:
got it, thanks for your replay and hopeful you can find the approach to solve this issue.
I can look at this, but it might be a week or so, I'd be happy for any proposed PRs to expose the interface though!
Got some time to continue looking into this. Actually IShellView::Refresh is not at all expensive at least when called from a regular C++ shell extension. Not sure what it means, maybe I had really bad COM marshaling in C# or something. :thinking:
It does change scroll position though, so in that sense it's somewhat annoying. Maybe there's still some other way to reload icons.