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
It's done using TrayBandSiteService and IBandSite. Check out this thread...
Regards,
Jeremy Boschen
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
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
You should be able to get around this with SHLoadInProc();
Regards,
Jeremy Boschen
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
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.
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
You may need to use a newer version of the SDK.
http://msdn.microsoft.com/platformsdk/
Do you have your VC++ directories set up correctly to point to the new SDK?
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
This symbol is defined in uuid.lib, which should be pulled in automatically. Double check that your lib path is set up correctly.