Récupération de la liste des logiciels installés sur poste
Bonjour,
Je cherche à interroger la base de registre pour en extraire la liste des logiciels installés ainsi que le chemin complet vers leur exécutables respectif depuis Access 97.
A priori, il faut utiliser la référence "Windows script host object model", mais comme c'est la base de registre que je veux interroger, je voudrais pas faire de bêtises ....
Avez vous déjà fait ca ? Pourriez vous me donner des codes exemples et des explications ?
Isa911
Ma réponse pour l'ouverture d'un fichier même si l'on a que le raccourci
Uniquement testé sur Windows 2000.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Private Declare Function FindExecutable Lib "shell32.dll" _
Alias "FindExecutableA" (ByVal lpFile As String, _
ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Const MAX_FILENAME_LEN = 260
'Ouvre un fichier avec l'application installée dans Windows
'Prend en compte les raccourcis sur les fichiers
Public Sub ouvreFichierAvecApplication(strMyFile As String)
Dim strApplicationFilename As String
Dim strFullExecutionPath As String
Dim lngShell As Double
'Le fichier est-il un lien ?
If (Right(strMyFile, 3) = "lnk") Then
Set WshShell = CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oShellLink = WshShell.CreateShortcut(strMyFile)
nomDuFichier = oShellLink.TargetPath
Else
nomDuFichier = strMyFile
End If
strApplicationFilename = GetApplicationFilename(nomDuFichier)
If Len(strApplicationFilename) Then
strFullExecutionPath = strApplicationFilename & " " & nomDuFichier
lngShell = Shell(strFullExecutionPath, 3)
Else
MsgBox "There is no application installed on this computer for this type of files '" & nomDuFichier & " !", 48
End If
End Sub
Private Function GetApplicationFilename(ByVal ApplicationFilename As String) _
As String
Dim lngSuccess As Integer, strBuffer As String
Dim strExecutablePath As String
strExecutablePath = vbNullString
If Dir(ApplicationFilename) = vbNullString Or Len(ApplicationFilename) = 0 Then
Else
strBuffer = String(MAX_FILENAME_LEN, 32)
lngSuccess = FindExecutable(ApplicationFilename, vbNullString, strBuffer)
If lngSuccess > 32 Then
strExecutablePath = Left$(strBuffer, InStr(strBuffer, Chr$(0)) - 1)
End If
End If
GetApplicationFilename = strExecutablePath
End Function |