I have written a toolbar that runs on the taskbar. Unfortunately, after it is installed, the user has to enable it manually. Is there a way to tell explorer to open (or close) a given toolbar?
I would like for the installer, NSIS, to turn on the toolbar when the installation is complete (I realize that a plugin would be necessary).
I also want to know if it's possible to automatically enable a toolbar for all users, for example in a corporate environment where multiple users would share a PC.
Edit: This code can now Add a deskband 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, an example use:
Guid address_toolbar_guid = new Guid("{01E04581-4EEE-11D0-BFE9-00AA005B4383}");
uint band_id = AddDeskbandToTray(address_toolbar_guid);
It would make sense that a similar call to RemoveBand would also do the trick, but as of yet, I can't get that code to work. Another issue: the added deskband closes when the application that added it closes.
You might want to check out this article . It looks like you can only do this ("officially" anyway) in Vista using the ITrayDeskBand interface .
I can't find the exact url right now, but I remember there being some discussion of this around PDC2008 where basically this was not enabled specifically so that random programs couldn't populate the taskbar w/o the users consent.
A side effect of this is that very few users even enable the WMP deskbar by default.
根据我的理解,任务栏位置和值等存储在注册表中(忘记确切的位置),因此如果找到特定的注册表项,您可以获取其位置并使安装程序在计算机上插入注册表项,以便启用任务栏。
Not really an answer to your question, but please, please: do not write shell extensions (and a taskbar is a shell extension) in .NET!
Basically, you're breaking other apps.
如果你检查得好,谷歌工具带存在,而exe后面运行(谷歌桌面版),所以如果你坚持谷歌或搜索栏实例化的方式,你应该再次检查TrayBandSiteService并制作支持exe ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.