FBar.InternetExplorer
(1)
Vista
(1)
CComQIPtr
(1)
VB
(1)
WebViewFolderContents
(1)
IWebBrowserAppand
(1)
IWebBrowserApp
(1)
IServiceProvider
(1)

Get IExplorerBrowser from a Windows Explorer (Vista)

Asked By Ivo Beltchev
07-Nov-09 01:32 PM
Hi

I am developing a band for Windows Explorer and I want to get notified
when the current folder changes. Looks like IExplorerBrowser provides
the notifications I need, but I cannot get that interface in my SetSite
function. I can get IShellBrowser:

STDMETHODIMP CExplorerBand::SetSite( IUnknown* pUnkSite )
{
if(pUnkSite)
{
CComQIPtr<IServiceProvider> pProvider=pUnkSite;

CComPtr<IShellBrowser> pShellBrowser;
if (pProvider)

pProvider->QueryService(SID_SShellBrowser,IID_IShellBrowser,(void**)&pShellBrowser);
}
return S_OK;
}

But I do not know what to do to get IExplorerBrowser. I tried
QueryInterface on pUnkSite and on pShellBrowser. I tried calling
QueryService with IID_IExplorerBrowser and different service IDs.
Nothing seems to work.

I am starting to think that IExplorerBrowser is only intended to be used
to host an explorer window in your own application because there are
many examples how to create a new instance but not how to get an
existing instance.

Any ideas?

Thanks
Ivo

You need to QueryInterface on IWebBrowserAppand IWebBrowser2.

mayayana replied to Ivo Beltchev
07-Nov-09 05:25 PM
You need to QueryInterface on IWebBrowserApp
and IWebBrowser2. I have code but it is in VB6, so
probably not much help to you, but here is the snippet:

Private UK1 As IUnknown
Dim ISP As IServiceProvider
Dim WB1 As UUID
Dim WB2 As UUID

Set UK1 = pUnkSite
Set ISP = pUnkSite

CLSIDFromString IID_IWebBrowserApp, WB1
CLSIDFromString IID_IWebBrowser2, WB2

Set FBar.InternetExplorer = ISP.QueryService(VarPtr(WB1), VarPtr(WB2))

That gives you the new shell folder as a
of that is the WebViewFolderContents, AKA
ShellFolderView, which provides the
SelectionChanged event. You probably also
want that.

I hope that is clear. I know the VB terminology
is different but I do not know how to explain it
in C++ terms.

pProvider->QueryService(SID_SShellBrowser,IID_IShellBrowser,(void**)&pShellB
rowser);

Woops. That should be QueryService, of course,not QueryInterface.

mayayana replied to mayayana
07-Nov-09 05:37 PM
Woops. That should be QueryService, of course,
not QueryInterface.

Thanks.

Ivo Beltchev replied to mayayana
07-Nov-09 05:56 PM
Thanks. I was able to get it to work using IWebBrowser2 and hooking to
the web document events. I was hoping to use IExplorerBrowser instead
because the event API looked a lot simpler.
Post Question To EggHeadCafe