Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' 直接调用COM对象
Dim wsh As Object = CreateObject("WScript.Shell")
Dim desk As String = wsh.SpecialFolders("Desktop")
Dim lnk As Object = wsh.CreateShortcut(desk & "\说明2.lnk")
With lnk
.Arguments = "/?" '传递参数
.Description = "我是直接调用COM创建的非托管对象创建的快捷方式!"
.IconLocation = "shell32.dll,23" '调用dll资源内的图标,索引在第23个图标,问号帮助
.TargetPath = Application.StartupPath & "\说明.txt"
.WindowStyle = 7 '打开窗体的风格,最小化
.WorkingDirectory = Application.StartupPath '工作路径
.Save() '保存快捷方式
End With
MsgBox("OK!", MsgBoxStyle.Information)
End Sub
End Class