PDA

View Full Version : نحوه شورت کات گیری از برنامه



h_a_m_i_d
دوشنبه 04 اردیبهشت 1391, 14:19 عصر
سلام دوستان عزیز میشه بگین چطوری میشه از برنامه شورت کات درست کرد

ممنون

xxnagin
دوشنبه 04 اردیبهشت 1391, 15:30 عصر
سلام
این یه لینک
IWshRuntimeLibrary را به پروژه اضافه کن
فایل dll هم داخل این لینک هستش
http://www.codeproject.com/Articles/11758/Conditional-Install-of-Desktop-and-Quick-Launch-Sh

Imports IWshRuntimeLibrary
Imports System.IO
Public Class Form1
Private Sub CreateShortCut(ByVal FileName As String, ByVal Title As String)
Try
Dim WshShell As New WshShell
' short cut files have a .lnk extension
Dim shortCut As IWshRuntimeLibrary.IWshShortcut = DirectCast(WshShell.CreateShortcut(FileName), IWshRuntimeLibrary.IWshShortcut)
' set the shortcut properties
With shortCut
.TargetPath = Application.ExecutablePath
.WindowStyle = 1I
.Description = Title
.WorkingDirectory = Application.StartupPath
' the next line gets the first Icon from the executing program
.IconLocation = Application.ExecutablePath & ", 0"
.Arguments = String.Empty
.Save() ' save the shortcut file
End With
Catch ex As System.Exception
MessageBox.Show("Could not create the shortcut" & Environment.NewLine & ex.Message, Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CreateShortCut(Path.Combine(Environment.GetFolderP ath(Environment.SpecialFolder.Desktop), "AwesomeApp.lnk"), "My Awesome app")
End Sub
End Class