منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : لانشاء اختصار على سطح المكتب
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كاتب الموضوع : Boutemine Oualid

السلام عليكم و رحمة الله وبركاته


كود :
Option Explicit
'Add a reference to Windows Script Host Object Model (wshom.ocx).
Private Sub CreateShortCutOnDeskTop()
Dim Wsh As New WshShell
Dim DesktopPath As String
Dim FileName As String
Dim Shortcut As Variant
DesktopPath = Wsh.SpecialFolders("Desktop")
FileName = DesktopPath & "\MyAppli.lnk"
If FileExist(FileName) = False Then
Set Shortcut = Wsh.CreateShortcut(FileName)
With Shortcut
.TargetPath = App.Path & "\" & App.EXEName
.Description = "My Program"
.WindowStyle = 4
.Save
End With
End If
End Sub
Private Function FileExist(ByRef inFile As String) As Boolean
On Error Resume Next
Let FileExist = CBool(FileLen(inFile) + 1)
End Function