![]() |
Tipp 0183
|
Desktop- & Startmenü-Verknüpfung anlegen
|
 |
|
Autor/Einsender: Datum: |
|
Detlev Schubert 31.12.2001 |
|
Entwicklungsumgebung: |
|
VB 6 |
|
|
Es ist gar nicht so schwer mit Visual Basic Verknüpfungen sowohl auf dem Desktop als auch
im Start-Menü anzulegen. Unter Nutzung der zum Setup-Kit gehörenden Datei VB6STKIT.DLL
bei VB 6 (VB5STKIT.DLL bei VB 5) Funktion CreateShellLink,
ist dies ohne viel Aufwand möglich.
|
|
Code im Codebereich des Moduls für VB 6 |
|
|
Option Explicit
Declare Function CreateShellLink Lib "vb6stkit.dll" Alias _
"fCreateShellLink" (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
Function VerknuepfungAnlegenVB6(Ziel As String, Pfadname _
As String, Text As String, Privat As Boolean) As Boolean
Dim sParent As String
sParent = "$(Programs)"
VerknuepfungAnlegenVB6 = _
CreateShellLink(Ziel, Text, Pfadname, "", Privat, sParent)
End Function
|
|
|
Code im Codebereich der Form |
|
|
Option Explicit
Private Sub Command1_Click()
Dim sZiel As String
Dim sPfad As String
Dim sText As String
Dim fPrivat As Boolean
If Option1(0).Value = True Then
sZiel = "..\..\Desktop"
ElseIf Option1(1).Value = True Then
sZiel = ".\Autostart"
Else
sZiel = "."
End If
sText = "VB-fun.de Beispiel"
sPfad = App.Path & "\Projekt1.exe"
fPrivat = True
If VerknuepfungAnlegenVB6(sZiel, sPfad, sText, _
fPrivat) = True Then
MsgBox "Verknüpfung wurde erstellt.", 64, Me.Caption
Else
MsgBox "Verknüpfung konnte nicht erstellt werden.", _
16, "Fehler"
End If
End Sub
|
|
|
Hinweis für VB 5-Anwender |
|
Der entsprechende Code für VB 5 befindet sich im Download-Beispiel!
|
|
Windows-Version |
95 |
 |
|
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
VB-Version |
VBA 5 |
 |
|
VBA 6 |
 |
|
VB 4/16 |
 |
|
VB 4/32 |
 |
|
VB 5 |
 |
|
VB 6 |
 |
|
|
|
Download (4,1 kB)
|
Downloads bisher: [ 2739 ]
|
|
|