17-10-12, 02:19 PM
كاتب الموضوع : 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