-
Pin to start menu
With xp it's easy to pin items to the start menu, by simply adding a reference to
"Windows script host object model"
However, this doesn't seem to work on Vista.
Does anyone know if this is possible with Vista?
XP
Pin
Code:
Private Sub Form_Load()
Dim objShell As Object
Dim objFolder As Object
Dim objApp As Object
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Windows\System32")
Set objApp = objFolder.ParseName("notepad.exe")
If objApp Is Nothing Then
MsgBox ("Executable not found. Make sure the path and file name are correct.")
Else
objApp.InvokeVerb ("P&in to Start Menu")
End If
End Sub
Unpin
Code:
Private Sub Form_Unload(Cancel As Integer)
Dim objShell As Object
Dim objFolder As Object
Dim objApp As Object
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Windows\System32")
Set objApp = objFolder.ParseName("notepad.exe")
If objApp Is Nothing Then
MsgBox ("Executable not found. Make sure the path and file name are correct.")
Else
objApp.InvokeVerb ("Unp&in from Start Menu")
End If
End Sub
VISTA
This vb script works on Vista:
Code:
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace("C:\Windows\System32\")
Set objApp = objFolder.ParseName("notepad.exe")
For Each verb in objFolderItem.Verbs()
If verb.Name = "P&in to Start Menu" Then verb.DoIt
Next
The nice thing about doing it this way on Vista, is that you can also use the handy verbs
Create &Shortcut, and Add to Quick Launch