OVH Cloud OVH Cloud

creation de racourci avec un shell.......

2 réponses
Avatar
je voudrais utiliser un code en VB6 permettant de cr=E9er=20
des racourcis et de les mettre dans un dossier (demarage=20
par ex).J'utilise un "objet shell" de type:

Sub RLien(Location As String, Cible As String)

Set a =3D CreateObject("Wscript.Shell")
Set b =3D a.CreateShortcut(Location)
b.TargetPath =3D Cible
b.Save
End Sub

Cependant j'obtiens la r=E9ponse:
erreur execution
erreur automation
classfactory ne peut pas fournir la classe demand=E9!

que cela signifie-t-il? comment y remedier?
merci pour votre aide

2 réponses

Avatar
François Picalausa
Hello,

Je te conseille de jeter un oeil au dernier CD fournit avec VB6. Il montre
entre autre comment utiliser l'interface IShellLink pour créer proprement un
raccourci.

--
François Picalausa (MVP VB)
http://faq.vb.free.fr --- http://msdn.microsoft.com
http://apisvb.europe.webmatrixhosting.net

a écrit dans le message de
news:5be901c474b2$2962d480$
je voudrais utiliser un code en VB6 permettant de créer
des racourcis et de les mettre dans un dossier (demarage
par ex).


Avatar
Ludovic SOEUR
Voila ce que j'utilise en gros pour créer un raccourci :

Dim WSHShell, Shortcut 'Pour la création d'un raccourci
Set WSHShell = CreateObject("WScript.Shell")
Set Shortcut = WSHShell.CreateShortcut(REP_SHORTCUT & "toto.lnk")
With Shortcut
.TargetPath = WSHShell.ExpandEnvironmentStrings( le chemin du fichier
dont on veut un raccourci )
.IconLocation = WSHShell.ExpandEnvironmentStrings( le chemin de
l'icone )
.Description = "Ma description"
.WindowStyle = 4
End With
Shortcut.save
Set WSHShell = Nothing
Set Shortcut = Nothing

Et pour avoir le REP_SHORTCUT (le répertoire de base du menu démarrer) :
Private Const MAX_PATH = 260
Private Const CSIDL_PROGRAMS As Long = &H2 'Menu démarrer
Private Const SHGFP_TYPE_CURRENT = &H0 'current value for
user, verify it exists
strPath = String(MAX_PATH, 0)
lngReturn = SHGetFolderPath(0, CSIDL_PROGRAMS, 0, SHGFP_TYPE_CURRENT,
strPath)
If lngReturn = 0 Then REP_SHORTCUT = Left$(strPath, InStr(1, strPath,
Chr(0)) - 1)

@+
Ludovic Soeur.


a écrit dans le message de news:
5be901c474b2$2962d480$
je voudrais utiliser un code en VB6 permettant de créer
des racourcis et de les mettre dans un dossier (demarage
par ex).J'utilise un "objet shell" de type:

Sub RLien(Location As String, Cible As String)

Set a = CreateObject("Wscript.Shell")
Set b = a.CreateShortcut(Location)
b.TargetPath = Cible
b.Save
End Sub

Cependant j'obtiens la réponse:
erreur execution
erreur automation
classfactory ne peut pas fournir la classe demandé!

que cela signifie-t-il? comment y remedier?
merci pour votre aide