Creation de raccourci

titim77 - 29 oct. 2001 à 22:55
jul00 Messages postés 85 Date d'inscription samedi 20 novembre 2004 Statut Membre Dernière intervention 18 juin 2009 - 8 juin 2005 à 09:05
salut tout le monde , je voudrais creer un raccourci
mais helas ca ne fonctionne pas voici le code
ou ai-je fais l'erreur ???
Private Declare Function OSfCreateShellLink 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
Private Sub Command1_Click()
Call OSfCreateShellLink("C:\WINDOWS\Profiles\thierry\Menu Démarrer\Programmes\Démarrage", "essai raccourci", "c:\program files\dap\dap.exe", "", 0, "")
End
End Sub

merci pour votre precieuse aide :o)

3 réponses

ZTPdiffusion
30 oct. 2001 à 19:19
Salut,

Moi pour créer un raccourci sur le bureau et/ou dans le menu démarrer voire les autres menus, j'utilise ce code
(Penser à référencer dans le projet WSHOM.OCX - windows script host object model)
(dans le code "projet1" correspond au programme pour lequel on veut un raccourci)

Private Sub Form_Load()
'Copie dans menu démarrage
Dim sDesk As String
Dim oShell As New IWshShell_Class
Dim oShortCut As New IWshShortcut_Class

' Chemin d'accès du répertoire "bureau"

sDesk = oShell.SpecialFolders.Item("Startup")
'sDesk = oShell.SpecialFolders.Item("StartMenu")
'sDesk = oShell.SpecialFolders.Item("Programs")
'sDesk = oShell.SpecialFolders.Item("Desktop")

Set oShortCut = oShell.CreateShortcut(sDesk & "\Projet1.lnk")


With oShortCut
If Right(App.Path, 1) = "" Then
.TargetPath = App.Path + "projet1.exe"
Else
.TargetPath = App.Path + "\projet1.exe"
End If
.Description = "Projet1"
' .Arguments = txtArguments
.WorkingDirectory = App.Path
.WindowStyle = 1
' Note: vous pouvez ajouter une touche de raccourci - par exemple :
'
' .Hotkey = "ALT+CTRL+F"
' .Hotkey = "ALT+O"
' .Hotkey = "A"
.Save
End With

Set oShell = Nothing
Set oShortCut = Nothing

End Sub
0
demiebruce Messages postés 15 Date d'inscription jeudi 19 février 2004 Statut Membre Dernière intervention 28 octobre 2005
30 mars 2004 à 15:41
Comment peux ton faire la meme chose mais sous ACCESS.
Merci par avance...

Demiebruce
0
jul00 Messages postés 85 Date d'inscription samedi 20 novembre 2004 Statut Membre Dernière intervention 18 juin 2009
8 juin 2005 à 09:05
moi je fait ca
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")


Dim monrac
' Création d'un objet raccourci
Set monrac = WSHShell.CreateShortcut("chemin de ton raccouci")


' Paramétrage des propriétés de l'objet raccourci et sauvegarde
With monrac
.TargetPath = WSHShell.ExpandEnvironmentStrings("chemin de l'application vers la quelle pointe le raccourci")
.Save
End With
0
Rejoignez-nous