vb.net创建快捷式

前端之家收集整理的这篇文章主要介绍了vb.net创建快捷式前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

出处: http://hi.baidu.com/khtkfjhhsou/blog 原文链接:https://www.f2er.com/vb/259773.html

猜你在找的VB相关文章