Open subfolder in Windows namespace extension

I am implementing a Basic Folder object to expand a namespace consisting of folders and subfolders (a junction is a file system folder that is empty). I have implemented IShellFolder and support returning IContextMenu to ShellFolderImpl::GetUIObjectOf .

Suppose I have the following folders (where A and A \ B are the "virtual" folders created by IShellFolder::EnumObjects )

  C:\test.{74660590-4BEF-4BF4-9C85-5FAE0E084926} C:\test.{74660590-4BEF-4BF4-9C85-5FAE0E084926}\A C:\test.{74660590-4BEF-4BF4-9C85-5FAE0E084926}\A\B 

I can open C:\test.{74660590-4BEF-4BF4-9C85-5FAE0E084926} and it lists folder A. When I double-click (or select Open from the context menu) in folder A, this folder opens and in the view subfolder B is displayed.

Problem: this only works for folders directly under C:\test.{74660590-4BEF-4BF4-9C85-5FAE0E084926} . The context menu is not displayed for subfolder B (and GetUIObjectOf never called even if IShellFolder:Initialize is called with the correct PIDL).

In the corresponding part of IContextMenu::InvokeCommand I will open the subfolder by doing

  SHELLEXECUTEINFO sei = { 0 }; sei.cbSize = sizeof(sei); sei.fMask = SEE_MASK_IDLIST | SEE_MASK_CLASSNAME; sei.lpIDList = pidl; // the fully qualified PIDL sei.lpClass = TEXT("folder"); sei.hwnd = pcmi->hwnd; sei.nShow = pcmi->nShow; sei.lpVerb = cmd.verb.w_str(); BOOL bRes = ::ShellExecuteEx(&sei); DeletePidl(pidl); return bRes?S_OK:HR(HRESULT_FROM_WIN32(GetLastError())); 
+4
source share

Source: https://habr.com/ru/post/1502219/


All Articles