史萊姆論壇

史萊姆論壇 (http://forum.slime.com.tw/)
-   程式語言討論區 (http://forum.slime.com.tw/f76.html)
-   -   [使用版本VB2008]在桌面建立程式捷徑 (http://forum.slime.com.tw/thread275430.html)

魔術王子 2014-02-06 08:31 PM

[使用版本VB2008]在桌面建立程式捷徑
 
執行畫面
https://imagizer.imageshack.us/v2/277x91q90/834/yszq.jpg
按下[建立捷徑]後,桌面便會出現程式捷徑
https://imagizer.imageshack.us/v2/537x212q90/545/5mes.jpg
引用:

作者: 程式碼
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



所有時間均為台北時間。現在的時間是 12:28 PM

Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.

『服務條款』

* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *


SEO by vBSEO 3.6.1