我想在Windows 7盒子(64位)上从vb.net代码创建桌面快捷方式。下面的代码适用于XP,但是在Win7上运行我刚刚得到一个消息,说明该应用程序已停止工作:在Windows 7盒子(64位)创建vb.net的快捷方式
Imports IWshRuntimeLibrary
Dim WshShell As WshShellClass = New WshShellClass
Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut
' The shortcut will be created on the desktop
'Win 7
MyShortcut = CType(WshShell.CreateShortcut("C:\Users\Public\Desktop\iexplore.lnk"), IWshRuntimeLibrary.IWshShortcut)
'MyShortcut = CType(WshShell.CreateShortcut("C:\Documents and Settings\All Users\Desktop\iexplore.lnk"), IWshRuntimeLibrary.IWshShortcut)
MyShortcut.TargetPath = "C:\Program Files\Internet Explorer\iexplore.exe" 'Specify target app full path
MyShortcut.Description = "IE"
MyShortcut.Save()
任何想法或更好的方法来创建代码运行在Win7的框shorcut?
哦,而且我多年来都没有做过VB。感谢您的心理锻炼。 :) – 2010-06-14 15:08:12
我只是试过,我仍然得到相同的结果不知道为什么... – Matt 2010-06-14 15:31:27
其实我得到它的感谢! – Matt 2010-06-14 15:36:42