Imports System.IO
Using IWshRuntimeLibrary
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'读文件路径
Dim apppath As String = Directory.GetCurrentDirectory()
Dim file As New System.IO.StreamReader(apppath & "\wjm.txt")
Dim wj As String = file.ReadToEnd()
file.Close()
Dim hqlj As New System.IO.StreamReader(apppath & "\lj.txt")
Dim lujingm As String = hqlj.ReadToEnd()
file.Close()
'发快捷方式到桌面
Dim appName = apppath & lujingm & wj & ".lnk"
Dim desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim fileDesktop As FileInfo = New FileInfo(desktopPath + "\\" & appName & ".lnk")
If Not fileDesktop.Exists Then
Dim shell = New WshShell()
Dim shortcut = CType(shell.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\" & appName & ".lnk"), IWshShortcut)
shortcut.WorkingDirectory = System.Environment.CurrentDirectory
shortcut.WindowStyle = 1
shortcut.Description = appName
shortcut.IconLocation = Application.ExecutablePath
shortcut.TargetPath = Application.StartupPath + "\\" + My.Application.Info.AssemblyName & ".exe"
shortcut.Save()
End If
MsgBox("成功")
End Sub
End Class 这样引用还是不行
此主题相关图片如下:1.png
已经做引用了
[此贴子已经被作者于2024/1/29 22:46:15编辑过]