Pin to start a shortcut on Windows 8 programmatically

£可爱£侵袭症+ 提交于 2019-12-12 06:28:05

问题


I have created an Installer using Installshield 2011. This Installer creates a shortcut in StartMenu-->Programs and it also has runs a vbscript during installation. This VB Script creates another shortcut in StartMenu-->Programs.

The problem is that the shortcut created by Installshield gets automatically "pinned to Start" and hence appear as a tile on metro UI on windows 8, but the shortcut created by VBScript is "NOT pinned to start" and is visible only after clicking on "All Apps" on the Metro UI Desktop.

What can I change in the VBScript so that the shortcut is pinned to start. Is there any API Which I can use?


回答1:


I don't have Windows 8 here, so I'm not sure if this will work, but it won't hurt to give it a try:

Set sa   = CreateObject("Shell.Application")
Set fldr = sa.NameSpace("C:\PATH\TO\SHORTCUT\FOLDER")
Set lnk  = fldr.ParseName("SHORTCUT.lnk")
For Each verb In lnk.Verbs
  If verb.Name = "Pin to Tas&kbar" Then verb.DoIt()
Next


来源:https://stackoverflow.com/questions/12455244/pin-to-start-a-shortcut-on-windows-8-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!