Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Aski
Hello cmoi,
Tu as savamment écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
1 - Depuis l'explorateur, click droit sur le fichier pour lequel on veut créer un raccourci. 2 - Depuis le bureau, click droit sur l'écran, puis Nouveau, puis Raccourci
Hello cmoi,
Tu as savamment écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk
Comment faire ?
Merci d'avance pour vos réponses.
cmoi
1 - Depuis l'explorateur, click droit sur le fichier pour lequel on veut
créer un raccourci.
2 - Depuis le bureau, click droit sur l'écran, puis Nouveau, puis Raccourci
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
1 - Depuis l'explorateur, click droit sur le fichier pour lequel on veut créer un raccourci. 2 - Depuis le bureau, click droit sur l'écran, puis Nouveau, puis Raccourci
Vincent Guichard
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la fonction suivante:
Private 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
Vincent Guichard
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk
Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la
fonction suivante:
Private 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
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la fonction suivante:
Private 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
Vincent Guichard
Jacques93
Bonjour cmoi, cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
En complément de la réponse d'Aski, une solution avec WSH, sur la FAQ :
<http://faq.vb.free.fr/index.php?question=5>
-- Cordialement,
Jacques.
Bonjour cmoi,
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk
Comment faire ?
En complément de la réponse d'Aski, une solution avec WSH, sur la FAQ :
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
En complément de la réponse d'Aski, une solution avec WSH, sur la FAQ :
<http://faq.vb.free.fr/index.php?question=5>
-- Cordialement,
Jacques.
cmoi
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois pas pourquoi je l'aurais posé ici. Par contre, je ne suis pas sûr de comprendre à quoi correspondent tous les paramètres. J'aimerais avoir un exemple. Merci
cmoi
"Vincent Guichard" a écrit dans le message de news: 469223a3$0$25929$
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la fonction suivante:
Private 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
Vincent Guichard
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois
pas pourquoi je l'aurais posé ici.
Par contre, je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple.
Merci
cmoi
"Vincent Guichard" <vg.bleuciel.sa@wanadoo.fr> a écrit dans le message de
news: 469223a3$0$25929$ba4acef3@news.orange.fr...
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk
Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la
fonction suivante:
Private 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
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois pas pourquoi je l'aurais posé ici. Par contre, je ne suis pas sûr de comprendre à quoi correspondent tous les paramètres. J'aimerais avoir un exemple. Merci
cmoi
"Vincent Guichard" a écrit dans le message de news: 469223a3$0$25929$
cmoi a écrit :
Bonjour à tous,
Je voudrais créer un raccourci : monraccourci.lnk Comment faire ?
Merci d'avance pour vos réponses.
cmoi
Si la question c'est "Comment le faire via VB6", il faut utiliser la fonction suivante:
Private 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
Vincent Guichard
Vincent Guichard
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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
cmoi a écrit :
> je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple.
Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI'
Private 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
Private Sub Form_Load()
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 = "Shortcut to Calculator"
strLinkPath = "c:Windowscalc.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 = "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
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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
Gloops
cmoi a écrit, le 09/07/2007 15:06 :
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois pas pourquoi je l'aurais posé ici.
Tu sais, il y a eu de la grêle, aujourd'hui. Ce n'est pas bon pour la concentration, ça :)
Par contre, je ne suis pas sûr de comprendre à quoi correspondent t ous les paramètres. J'aimerais avoir un exemple. Merci
En suivant Google, sur fCreateShellLink, on arrive là : http://support.microsoft.com/kb/467693/fr
Autrement, pour la mise en uvre des API, voici une bonne adresse : http://allapi.mentalis.org/agnet/apiguide.shtml
Leur moteur de recherche (avec scripts) mène là : http://allapi.mentalis.org/apilist/fCreateShellLink.shtml
où on trouve deux liens sur des exemples, après avoir eu le détail des paramètres.
cmoi a écrit, le 09/07/2007 15:06 :
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois
pas pourquoi je l'aurais posé ici.
Tu sais, il y a eu de la grêle, aujourd'hui.
Ce n'est pas bon pour la concentration, ça :)
Par contre, je ne suis pas sûr de comprendre à quoi correspondent t ous les
paramètres. J'aimerais avoir un exemple.
Merci
En suivant Google, sur fCreateShellLink, on arrive là :
http://support.microsoft.com/kb/467693/fr
Autrement, pour la mise en uvre des API, voici une bonne adresse :
http://allapi.mentalis.org/agnet/apiguide.shtml
Leur moteur de recherche (avec scripts) mène là :
http://allapi.mentalis.org/apilist/fCreateShellLink.shtml
où on trouve deux liens sur des exemples, après avoir eu le détail des
paramètres.
Il me paraissait évident que ma question était "avec VB6", sinon je ne vois pas pourquoi je l'aurais posé ici.
Tu sais, il y a eu de la grêle, aujourd'hui. Ce n'est pas bon pour la concentration, ça :)
Par contre, je ne suis pas sûr de comprendre à quoi correspondent t ous les paramètres. J'aimerais avoir un exemple. Merci
En suivant Google, sur fCreateShellLink, on arrive là : http://support.microsoft.com/kb/467693/fr
Autrement, pour la mise en uvre des API, voici une bonne adresse : http://allapi.mentalis.org/agnet/apiguide.shtml
Leur moteur de recherche (avec scripts) mène là : http://allapi.mentalis.org/apilist/fCreateShellLink.shtml
où on trouve deux liens sur des exemples, après avoir eu le détail des paramètres.
cmoi
Excellent . Merci. Même si je n'ai pas compris à quoi servait le vbNullChar
Marc
"Vincent Guichard" a écrit dans le message de news: 46933499$0$25918$
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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
Excellent . Merci. Même si je n'ai pas compris à quoi servait le vbNullChar
Marc
"Vincent Guichard" <vg.bleuciel.sa@wanadoo.fr> a écrit dans le message de
news: 46933499$0$25918$ba4acef3@news.orange.fr...
cmoi a écrit :
> je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple.
Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI'
Private 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
Private Sub Form_Load()
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 = "Shortcut to Calculator"
strLinkPath = "c:Windowscalc.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 = "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
Excellent . Merci. Même si je n'ai pas compris à quoi servait le vbNullChar
Marc
"Vincent Guichard" a écrit dans le message de news: 46933499$0$25918$
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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
cmoi
Bonjour,
Si je peux encore me permettre une petite question, dans l'exemple à quoi sert le fPrivate ? Pourquoi est-il défini long dans la déclaration et booleean à l'utilisation ? Merci
cmoi
"Vincent Guichard" a écrit dans le message de news: 46933499$0$25918$
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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
Bonjour,
Si je peux encore me permettre une petite question, dans l'exemple à quoi
sert le fPrivate ? Pourquoi est-il défini long dans la déclaration et
booleean à l'utilisation ?
Merci
cmoi
"Vincent Guichard" <vg.bleuciel.sa@wanadoo.fr> a écrit dans le message de
news: 46933499$0$25918$ba4acef3@news.orange.fr...
cmoi a écrit :
> je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple.
Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI'
Private 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
Private Sub Form_Load()
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 = "Shortcut to Calculator"
strLinkPath = "c:Windowscalc.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 = "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
Si je peux encore me permettre une petite question, dans l'exemple à quoi sert le fPrivate ? Pourquoi est-il défini long dans la déclaration et booleean à l'utilisation ? Merci
cmoi
"Vincent Guichard" a écrit dans le message de news: 46933499$0$25918$
cmoi a écrit : > je ne suis pas sûr de comprendre à quoi correspondent tous les
paramètres. J'aimerais avoir un exemple. Merci
Voila:
'Source: MSDN column 'Ask Dr. GUI' Private 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 Private Sub Form_Load() 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 = "Shortcut to Calculator" strLinkPath = "c:Windowscalc.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 = "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