is it possible to create taskbar icons (shortcuts, shell links, whatever you want them to be named) in the installer in Windows 7? I know this is not possible with the quick launch toolbar in previous windows version, but maybe someth开发者_开发知识库ing has changed in windows 7?
I'm assuming you want to pin an icon to the taskbar. No, that is not programmatically possible, and with good reason. It is your user's job to decide if your program is cool enough that they want it to be pinned to the taskbar.
If this is a corporate environment, note also that there is no group policy setting to affect a pinned item. If you Google around, there are some dirty hacks to get things pinned to the taskbar, but it involves overwriting all of the user's currently pinned items, which is a very bad idea. (I can see the helpdesk calls: "Where did my icons go??? I can't start the internet!")
Yes, it is possible through a VBScript to pin for the current user
http://www.codeproject.com/Articles/185512/Programmatically-PIN-shortcut-onto-Taskbar-on-Win7.aspx
This script can also be created at runtime by this C# .NET Class:
http://blog.ananthonline.net/?p=37
If you are an OEM you can pin to all users during the DASH process with the following command
Reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\TBDEn /v SBOEM0 /t REG_EXPAND_SZ /d “SomeFile.lnk” /f
Windows 7 taskbar pinned icons are stored in the following locations:
File System: %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
Registry: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
To deploy a pinned item, you can perform the following steps:
- Configure Pinned items on a Windows 7 system as a reference computer.
- Export Registry Key to pinned.reg file:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband]
And copy items in the %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
to a shared folder.
- Create a logon script to deploy the registry keys and copy the corresponding files.
Please note that the %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned
folder is only created after a user has pinned an icon to the taskbar. In the logon script, you will need to create the %APPDATA%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
folder if it does not exist.
PLEASE ALSO NOTE THIS REPLACES ALL ICONS CURRENTLY IN LOCATION!!! So, for me, this is suitable as it is only being used on our DR terminals where the users shouldn't be trying to personalise anything and are going to be moving from terminal to terminal on demand.
Finally: There is another way to do it using this VBS script, which allows you to add to the users current collection of pinned items:
http://blogs.technet.com/b/deploymentguys/archive/2009/04/08/pin-items-to-the-start-menu-or-windows-7-taskbar-via-script.aspx
I didn't like this method as it involves a logon script.
There is no api available to pin an application to the taskbar because Microsoft doesn't want you to do that.
http://msdn.microsoft.com/en-us/library/dd378460(v=VS.85).aspx#unified
精彩评论