Link - Collegamento sul desktop, avvio, programmi




Link - Collegamento sul desktop, avvio, programmi

Link - Collegamento sul desktop, avvio, programmi visual basic 6

trovato su http://msdn.microsoft.com/library/default.asp?url=/archive/en-us/dnaraskdr/html/drgui10_2.asp

nel modulo:
Option Explicit

Public Declare Function fCreateShellLink Lib "vb6stkit.dll" (ByVal lpstrFolderName As String, _
ByVal lpstrLinkName As String, ByVal lpstrLinkPath As String, _
ByVal lpstrLinkArguments As String, ByVal fPrivate As Long, _
ByVal sParent As String) As Long


nel form o dove vuoi

Private Sub Command2_Click()
Dim strGroupName As String, strLinkName As String
Dim strLinkPath As String, strLinkArguments As String
Dim fPrivate As Boolean, sParent As String
Dim fSuccess As Boolean

strLinkName = "Paolo the genius"
strLinkPath = App.Path & "\Paolo.exe"
strLinkArguments = ""
fPrivate = True ' Add shortcut to desktop.
strGroupName = "..\..\Desktop"
sParent = "$(Programs)"
fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, fPrivate, sParent)
'the path should never be enclosed in double quotes

If fSuccess Then
MsgBox "Created desktop shortcut"
Else
MsgBox "Unable to create desktop shortcut"
End If

' Add shortcut to Programs menu.

strGroupName = "$(Programs)"
sParent = "$(Programs)"
fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, _
fPrivate, sParent)
'the path should never be enclosed in double quotes

If fSuccess Then
MsgBox "Created shortcut on Programs menu"
Else
MsgBox "Unable to create shortcut on Programs menu"
End If

' Add shortcut to Startup folder of Programs menu.

strGroupName = "Esecuzione automatica" ' "Startup"
sParent = "$(Programs)"
fSuccess = fCreateShellLink(strGroupName & vbNullChar, strLinkName, strLinkPath, strLinkArguments & vbNullChar, fPrivate, sParent)
'the path should never be enclosed in double quotes

If fSuccess Then
MsgBox "Created shortcut in Startup folder"
Else
MsgBox "Unable to create shortcut in Startup folder"
End If
End Sub














( linkcollegamentosuldesktopavvioprogrammi.html )- by Paolo Puglisi - Modifica del 17/12/2023