Parsi Coders
ساخت shortcut - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: ساخت shortcut (/showthread.php?tid=3054)



ساخت shortcut - gachboy - 02-11-2013

سلام.چطور با داشتن ادرس یک فایل اجرایی میشه شورتکاتش هر جا که خواستیم بسازیم؟؟


RE: ساخت shortcut - Amin_Mansouri - 02-11-2013

درود
خوب هستی ؟
یه مثال میزنم که روی دسکتاپ میسازی
بفرمایید : 
کد:
'Description:


'This vb6 code allows you to create a shortcut of any file on the desktop


'Please (Project > References > Add Microsoft Script RunTime
'Public By Parsicoders.com


Public Sub CreateShortcut(FilePath As String, ShortcutName As String)
Dim Filesys As New FileSystemObject
Dim WshShell As Object
Dim oShellLink As Object
Dim DesktopPath As String


Set WshShell = CreateObject("WScript.Shell")
DesktopPath = WshShell.SpecialFolders("Desktop")

 


Set oShellLink = WshShell.CreateShortcut(DesktopPath & "\" & ShortcutName & ".lnk")
If Filesys.FileExists(oShellLink) Then
    MsgBox ("Already Exist")
    Exit Sub
End If
   
oShellLink.TargetPath = FilePath
oShellLink.IconLocation = FilePath
oShellLink.WorkingDirectory = FilePath
oShellLink.Save


Set oShellLink = Nothing
Set WshShell = Nothing
End Sub

Private Sub Form_Load()
Call CreateShortcut("c:\amin.txt", "parsicoders")
End Sub