2

I know that IShellFolderView interface is no longer supported by the Windows Shell as of Windows 7. However I am still interested in the methods (i.e RemoveObject and AddObject) exposed by that interface. The following call no longer compiles

pShellView->QueryInterface(IID_IShellFolderView, (LPVOID*)&pShellFolderView)

because riid:IID_IShellFolderView is no longer present in shlobj.h (latest sdk). I need access to some methods that would allow me to remove/add or (hide/show) folder objects in a folder view. I read an article that suggested the following call:

SHShellFolderView_Message(?m_hwnd_cabinet?, SFVM_REMOVEOBJECT, (LPARAM)pidl);

however it doesn't seem to produce any effects. I suspect that maybe the hwnd provided (i.e m_hwnd_cabinet) is not the right one. Can anyone tell me what the correct handle would be there and how can I produce it? Or is there another method?

Thank you!


I am trying to tweak this project https://github.com/stefankueng/tools/blob/main/StExBar/src/Filter.cpp#L44 but it uses IID_IShellFolderView.

Reznicencu Bogdan
  • 902
  • 2
  • 11
  • 28
  • 2
    For the first question, you can use `__uuidof(IShellFolderView)`, for the second question, you should cast the PIDL (which is already a pointer), not a pointer to the PIDL https://learn.microsoft.com/en-us/windows/win32/shell/sfvm-removeobject – Simon Mourier Oct 27 '21 at 21:44
  • @SimonMourier Thank you for your response! But the issue regarding the missing constant is not linker related. I tested it as well and querying the interface is not succesful. More than that microsoft specifically deprecated that interface because ListViews were no longer suitable. I found this (https://doxygen.reactos.org/d5/dd0/classCDefView.html#ae364b5e54a26c12801ae2e007d211f68) that shows that interface depending on a ListViews. For the second one you are right. That is my bad. However it still doesn't work. Any other suggestions? Thank you. – Reznicencu Bogdan Oct 27 '21 at 22:30
  • 3
    I just answered your questions, but yes, with recent Windows, the interface is not available, as you pointed out in the link, that's expected ("not available is different from "not supported"). "Removing" an item in a Shell View depends on the corresponding Shell Folder in question. It has no global semantic meaning (it just meant something for Win32 list views that were behind Shell Views but Shell Views are not necessarily list views any longer). Maybe you are looking for IFolderFilter/IFolderFilterSite (not all folder support that either) – Simon Mourier Oct 28 '21 at 05:44
  • Never worked with IFolderFilter/IFolderFilterSite. I'll read more about them. Thank you! – Reznicencu Bogdan Oct 28 '21 at 08:03
  • 2
    IFolderFileSite is the starting point. You can get Query it from the explorer browser (the object that implements IExplorerBrowser). – Simon Mourier Oct 28 '21 at 15:05

0 Answers0