Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deskbands (again)

277 views
Skip to first unread message

Ian Bevan

unread,
Feb 9, 2005, 8:34:57 PM2/9/05
to
Hello all

Next deskband question: is it possible to programatically tell Explorer
to display a deskband ? I'd like to be able to have a checkbox in my
installation program that says 'Display Explorer Deskband' or whatever,
which would be the equivalent of the user doing a
right-click->Toolbars->My Deskband.

Searching for an answer for this on the web has so far provided
fruitless :-(

Cheers

Ian

Jeremy Boschen

unread,
Feb 9, 2005, 10:28:42 PM2/9/05
to
"Ian Bevan" <ian@bevantech_spmfree.com> wrote in message
news:420aba3f$1...@clear.net.nz...

> Hello all
>
> Next deskband question: is it possible to programatically tell Explorer to
> display a deskband ? I'd like to be able to have a checkbox in my
> installation program that says 'Display Explorer Deskband' or whatever,
> which would be the equivalent of the user doing a
> right-click->Toolbars->My Deskband.
>

It's done using TrayBandSiteService and IBandSite. Check out this thread...

http://groups-beta.google.com/group/microsoft.public.platformsdk.shell/browse_thread/thread/5b52326d40797715/028a8f384a32cee0?q=TrayBandSiteService&_done=%2Fgroups%3Fq%3DTrayBandSiteService%26hl%3Den%26lr%3Dlang_en%26rls%3DGGLD,GGLD:2004-41,GGLD:en%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Search&&d#028a8f384a32cee0

Regards,
Jeremy Boschen


Ian Bevan

unread,
Feb 10, 2005, 3:02:05 AM2/10/05
to
Thanks Jeremy, I'll give it a go.

Ian Bevan

unread,
Feb 10, 2005, 6:01:27 PM2/10/05
to
Hi Jeremy

Thanks, but this thread seems to deal with activating an already
displayed deskband. I'd like to be able to actually display it too.

Does anybody have the interface for TrayBandSiteService ? Can it be used
to display a deskband as well as activate it ?

Thanks

Ian
http://www.filejournal.com

Jim Barry

unread,
Feb 10, 2005, 6:48:50 PM2/10/05
to
Ian Bevan wrote:
> Thanks, but this thread seems to deal with activating an already
> displayed deskband. I'd like to be able to actually display it too.
>
> Does anybody have the interface for TrayBandSiteService ? Can it be used
> to display a deskband as well as activate it ?

As shown in the code snippet I previously posted, the TrayBandSiteService object supports the IBandSite interface. Unfortunately, adding a new band might be a bit tricky. In theory you could create a new band object and pass it to IBandSite::AddBand, but there are likely to be problems if the band object is not created from within the Explorer process.

--
Jim Barry, MVP for Windows SDK

Jeremy Boschen

unread,
Feb 10, 2005, 8:16:17 PM2/10/05
to

"Jim Barry" <j...@mvps.org> wrote in message
news:eebPas8D...@TK2MSFTNGP10.phx.gbl...

Ian Bevan wrote:
>
> but there are likely to be problems if the band object is not created from
> within the Explorer process.

You should be able to get around this with SHLoadInProc();

Regards,
Jeremy Boschen


Jeremy Boschen

unread,
Feb 10, 2005, 8:42:14 PM2/10/05
to
"Jeremy Boschen" <jbos...@ptd.net> wrote in message
news:uDBNjc9D...@TK2MSFTNGP09.phx.gbl...

I actually just tried this, though I used SHCoCreateInstance() to create the
Address bar, instead of using SHLoadInProc() but it has the same result.

void ShowAddressBar( ) {
CLSID CLSID_AddressBand = {0x01E04581, 0x4EEE, 0x11d0, 0xBF, 0xE9, 0x00,
0xAA, 0x00, 0x5B, 0x43, 0x83};
CComPtr<IUnknown> spBandService;
CComPtr<IBandSite> spBandSite;
CoInitialize(NULL);
if ( SUCCEEDED(spBandService.CoCreateInstance(CLSID_TrayBandSiteService,
NULL)) &&
SUCCEEDED(spBandService->QueryInterface(&spBandSite)) ) {
CComPtr<IUnknown> spBand;
if ( SUCCEEDED(SHCoCreateInstance(NULL, &CLSID_AddressBand, NULL,
IID_IUnknown, (void**)&spBand)) )
spBandSite->AddBand(spBand);
}

spBandSite = NULL;
spBandService = NULL;
CoUninitialize();
}

Using SHLoadInProc(), you would have to load a lightweight object that shows
the bar when it is instantiated as it doesn't give you a reference to do the
work outside of the shell process like SHCoCreateInstance() does.

Regards,
Jeremy Boschen


Jim Barry

unread,
Feb 11, 2005, 6:54:20 AM2/11/05
to
Jeremy Boschen wrote:
> Using SHLoadInProc(), you would have to load a lightweight object that shows
> the bar when it is instantiated as it doesn't give you a reference to do the
> work outside of the shell process like SHCoCreateInstance() does.

Errr, no it doesn't. SHCoCreateInstance is semantically equivalent to CoCreateInstance, it just shortcuts to the shell's class factory to avoid some registry lookups. Your code initially appears to show the address band, but any attempt to use the band quickly shows that all is not well. And when its host process exits, the band goes up in smoke completely. The SHLoadInProc approach should work OK, though.

Jeremy Boschen

unread,
Feb 11, 2005, 6:26:36 PM2/11/05
to
"Jim Barry" <j...@mvps.org> wrote in message
news:OP0zrBD...@TK2MSFTNGP15.phx.gbl...

>
> Errr, no it doesn't.

Right, for brevity I only wanted to demonstrate that you can force a band to
display, but functionally the band doesn't work. I assumed that
CLSID_AddressBar was internal and not registered and so required the use of
SHCoCreateInstance.

If you do want a complete working example of it, I threw something together
here:
http://www.mutexed.com/code/misc/ConTest.zip

Regards,
Jeremy Boschen


Ian Bevan

unread,
Feb 13, 2005, 3:43:09 AM2/13/05
to
Fantastic guys, thanks a lot.

Jim Barry

unread,
Apr 28, 2005, 6:51:56 PM4/28/05
to
Marco wrote:
> BandLoader error LNK2001: unresolved external symbol
> _CLSID_TrayBandSiteService

You may need to use a newer version of the SDK.

http://msdn.microsoft.com/platformsdk/

Jim Barry

unread,
May 3, 2005, 9:40:25 AM5/3/05
to
Marco wrote:
> I installed the latest version but the error persist ! :-(

Do you have your VC++ directories set up correctly to point to the new SDK?

Marco Maroni

unread,
May 3, 2005, 9:53:18 AM5/3/05
to

"Jim Barry" <j...@mvps.org> wrote in message

Marco wrote:


> I installed the latest version but the error persist ! :-(

Do you have your VC++ directories set up correctly to point to the new SDK?

yes

Marco


Jim Barry

unread,
May 4, 2005, 10:59:35 AM5/4/05
to
Marco wrote:
> BandLoader error LNK2001: unresolved external symbol
> _CLSID_TrayBandSiteService

This symbol is defined in uuid.lib, which should be pulled in automatically. Double check that your lib path is set up correctly.

0 new messages