4

I maintain a explorer/file manager tool (xplorer2) that can replace windows explorer for opening folders. However I cannot trap the "open folder and select item" operation performed by SHOpenFolderAndSelectItems API.

I found an old thread by some other file manager programmer which implied that the right way is to register the "explorer-like" tool as a shell window, then respond to some queries to supply interfaces and services like IWebBrowserApp that will allow the item(s) to be selected

I registered my top level window with the shell windows successfully as such

CComPtr<IShellWindows> pShellWindows;
HRESULT hr = pShellWindows.CoCreateInstance(CLSID_ShellWindows);
hr = pShellWindows->Register(static_cast<IDispatch*>(this),
    (SHANDLE_PTR)hwTop, /*SWC_3RDPARTY*/SWC_EXPLORER, &m_dwCookie);
ATLASSERT(SUCCEEDED(hr));

the window does appear if enumerated among the shell windows. However when it is launched as a result of SHOpenFolderAndSelectItems (it is declared as an explorer replacement in HKEY_CLASSES_ROOT\Directory\shell), there are no attempts to QueryInterface or any other action on the IDispatch registered. I have tried both SWC_3RDPARTY and SWC_EXPLORER registration flags without any luck

any ideas what am I doing wrong?

nikos
  • 532
  • 3
  • 10
  • 1
    ok, so I must be banging at the wrong door, because that "other file manager" doesn't even register a shell window but nevertheless handles SHOpenFolderAndSelectItems nicely... – nikos Mar 04 '14 at 11:52
  • 1
    ok, now I am considering DDE as a possibility, can you at least tell me if I am going to waste another week on this defunct subject? I mean if DDE is not it just say so. There's a good sport! :) – nikos Mar 05 '14 at 10:59
  • 1
    DDE is definitely not it. – Jonathan Potter Mar 06 '14 at 11:10
  • 2
    thanks! on closer inspection I saw that you DO register a shell window after all... I think I'll go the DelegateExecute way – nikos Mar 06 '14 at 13:36
  • 2
    so now I have a COM server and sadly DelegateExecute only passes the main folder name without the selection. So it adds nothing to DDE or any other legacy mechanism. Let's see how much more time I'm going to waste on this... – nikos Mar 08 '14 at 08:11

1 Answers1

2

ok, I figured it out. The trick is really going round the buggy documentation

nikos
  • 532
  • 3
  • 10