Re: Shell_TrayWnd: unusual WM_COPYDATA messages

ilmcuts <[email protected]> Mon, 20 Oct 2003 20:38:30 +0200
Newsgroups gmane.comp.windows.shell-shocked.devel
Message-ID <5.1.1.6.2.20031020202759.020779f0@localhost>
At 23:26 19.10.2003 -0500, jugg wrote:
> > I think a WM_COPYDATA message is also sent to Shell_TrayWnd when
> > someone calls SHLoadInProc. I saw some code once that handled it, but
> > I cannot find a reference to it anywhere now.  That might be what you're
> > seeing.
> >
> > --
> > Maduin
> >
>Yah, lpData of the COPYDATASTRUCT looks like it contains a CLSID, so I'd
>say that's what it is, since SHLoadInProc passes a CLSID.  But I don't see
>it being useful to us, as all it does is load the indicated container into
>the shell's process space.
>
>The CLSID it is trying to load on my system is:
>{FFDC1A80-D527-11D0-A32C-34AF06C10000}

That's the same CLSID I got here. Interestingly, clicking on "Open network 
connections" in the DUN icon's context menu also triggered this. Here's a 
first implementation:

...
REFCLSID rclsid = (REFCLSID)*(CLSID*)pcds->lpData;
return pTrayService->HandleSHLoadInProc(rclsid);
...

HRESULT TrayService::HandleSHLoadInProc(REFCLSID rclsid)
{
     IUnknown* pUnk = NULL;

     HRESULT hr = CoCreateInstance(rclsid, NULL,
         CLSCTX_INPROC_SERVER, // | CLSCTX_INPROC_HANDLER,
         IID_IUnknown, (void**)&pUnk);

     if(SUCCEEDED(hr) && pUnk)
     {
         pUnk->Release();
         hr = NOERROR;
     }
     else
     {
         hr = CLASS_E_CLASSNOTAVAILABLE;
     }

     return hr;
}

I'm not sure whether CLSCTX_INPROC_HANDLER is necessary. I'm also not sure 
if the error code is correct, but it seemed to be the most likely 
candidate. Does that look ok?

Another interesting question is whether we actually want to implement this. 
Most apps using SHLoadInProc probably take advantage of explorer-specific 
features which we can't provide...

Before I forget, here's the best description of SHLoadInProc I've found yet:
http://groups.google.com/groups?q=SHLoadInProc&selm=udfvFdRl%24GA.188%40cppssbbsa05


__________________________________________________
Subscription options and archive:
http://www.freelists.org/list/shell-coding