How can I programmatically specify the Windows taskbar to open (or close) this toolbar?

I wrote a toolbar

+3
source share
6 answers
  • This CodeProject comment does this by simulating keystrokes.
  • Vista + has an API for this, ShowDeskBand and HideDeskBand
  • Edit: this code can now add a desktop strip object (from Pinvoke.net and these two MSDN forum questions):

    [ComImport] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("4CF504B0-DE96-11D0-8B3F-00A0C911E8E5")] public interface IBandSite { [PreserveSig] uint AddBand([In, MarshalAs(UnmanagedType.IUnknown)] Object pUnkSite); [PreserveSig] void RemoveBand(uint dwBandID); } private uint AddDeskbandToTray(Guid Deskband) { Guid IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); Guid ITrayBand = new Guid("{F60AD0A0-E5E1-45cb-B51A-E15B9F8B2934}"); Type TrayBandSiteService = Type.GetTypeFromCLSID(ITrayBand, true); IBandSite BandSite = Activator.CreateInstance(TrayBandSiteService) as IBandSite; object DeskbandObject = CoCreateInstance(Deskband, null, CLSCTX.CLSCTX_INPROC_SERVER, IUnknown); return BandSite.AddBand(DeskbandObject); } 

And for example, use:

 Guid address_toolbar_guid = new Guid("{01E04581-4EEE-11D0-BFE9-00AA005B4383}"); uint band_id = AddDeskbandToTray(address_toolbar_guid); 

It would be prudent that a similar call to RemoveBand would also do the trick, but so far I cannot get this code to work. Another problem: the added column closes when the added application closes.

+10
source

You may want to check out this article . It looks like you can only do this (officially) in Vista using the ITrayDeskBand interface .

+3
source

I can’t find the exact url right now, but I remember that it was discussed around the PDC2008, where basically it wasn’t included specifically so that random programs could not fill the task bar without user consent.

A side effect of this is that very few users even turned on the WMP panel by default.

+2
source

From what I understand, the locations and values ​​of taskbars are stored in the registry (forgot the exact location), so if you find a specific registry key, you can take its location and make your installer insert the registry key on the computer to the taskbar.

+1
source

Not quite the answer to your question, but please, please: do not write shell extensions (and the taskbar is a shell extension) in .NET!

That is why .

Basically, you are violating other applications.

+1
source

if you check well, the google toolband exists while exe is running (GoogleDesktop.exe), so if you insist on how a web browser or search bar is created, you should check TrayBandSiteService again and make exe support ...

0
source

All Articles