2014-02-06, 08:31 PM
|
#1
|
版區管理員
|
[使用版本VB2008]在桌面建立程式捷徑
執行畫面

按下[建立捷徑]後,桌面便會出現程式捷徑
引用:
作者: 程式碼
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If My.Computer.FileSystem.FileExists(My.Computer.FileSystem.SpecialDirectories.Desktop & "\ShellLink.LNK") Then Button1.Enabled = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFolder As String = My.Computer.FileSystem.CurrentDirectory, strEXE As String = "ShellLink.exe"
Dim objWS As Object
objWS = CreateObject("WScript.Shell")
With objWS.CreateShortCut(objWS.SpecialFolders("Desktop") & "\ShellLink.LNK") '& Replace(strEXE, ".EXE", ".LNK", 1, , 1))
.TargetPath = objWS.ExpandEnvironmentStrings(strFolder & "\" & strEXE)
.WorkingDirectory = strFolder
.Description = "ShellLink"
.WindowStyle = 4
.IconLocation = objWS.ExpandEnvironmentStrings(strFolder & "\" & strEXE & ",0")
.Save()
End With
Button1.Enabled = False
End Sub
End Class
|
|
|
|
送花文章: 1540,
收花文章: 1574 篇, 收花: 3928 次
|