|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Oct 2007
Messaggi: 364
|
[ Vb.Net ] Nome e percorso Applicazioni Installate - Genymus
Salve, ho usato il seguente pezzo di codice per verificare se un'applicazione era installata:
Codice:
Imports Microsoft.Win32
...
Function OttieniProgrammi()
Dim Reg As RegistryKey = Registry.LocalMachine
Reg = Reg.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Uninstall")
For Each keyName As String In reg.GetSubKeyNames()
If (Reg.OpenSubKey(keyName).GetValue("DisplayName") Is Nothing) Then
ListBox1.Items.Add("Not] " & keyName)
Else
ListBox1.Items.Add("Els] " & Reg.OpenSubKey(keyName).GetValue("DisplayName").ToString())
End If
Next
Return True
End Function
Grazie Ps: Scartiamo subito la possibilità di fare una lista della cartella "Programmi"... Grazie in anticipo per le risposte... Genymus
__________________
Genymus!!! "Che cosa vorreste far incidere sulla vostra tomba?". "Torno fra 5 minuti." "Lucido" è quando credi soltanto a metà di ciò che ti dicono. "Brillante" è quando sai a quale metà credere. "Pensa, ogni volta che respiro muore un uomo." "Hai provato a fare qualcosa per l'alito?" Aforismieaforismi.it |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3210
|
Possiamo completare un po' quel codice, ad esempio così :
> La Function : Codice:
Private Function ProgrammiInstallati() As List(Of String)
Dim L As New List(Of String)
Dim SoftwareKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Using RK As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(SoftwareKey)
For Each skName As String In RK.GetSubKeyNames
Using SK As Microsoft.Win32.RegistryKey = RK.OpenSubKey(skName)
Try
If SK.GetValue("DisplayName") <> Nothing Then
If SK.GetValue("InstallLocation") <> Nothing Then
L.Add(SK.GetValue("DisplayName") & " -> " & SK.GetValue("InstallLocation"))
Else
L.Add(SK.GetValue("DisplayName") & " -> PATH NON DISPONIBILE.")
End If
End If
Catch ex As Exception
L.Add(" - ERRORE - ")
End Try
End Using
Next
End Using
Return L
End Function
Codice:
ListBox1.Items.Clear()
For Each S As String In ProgrammiInstallati()
ListBox1.Items.Add(S)
Next
Non ci ho studiato un granchè. Intanto vedi se può interessare come spunto... |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Oct 2007
Messaggi: 364
|
Magnifico...
è vero, da molti "Non disponibili" ma per fortuna per i programmi che mi interessano, funziona. Grazie Mille
__________________
Genymus!!! "Che cosa vorreste far incidere sulla vostra tomba?". "Torno fra 5 minuti." "Lucido" è quando credi soltanto a metà di ciò che ti dicono. "Brillante" è quando sai a quale metà credere. "Pensa, ogni volta che respiro muore un uomo." "Hai provato a fare qualcosa per l'alito?" Aforismieaforismi.it |
|
|
|
|
|
#4 | |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 3210
|
Quote:
In ogni caso penso non ci possa esimere dall'entrare anche in qualche cartella ( comunque non certo uno scan esteso a tutta la cartella "Programmi" ), per avere un risultato completo... |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 00:32.




















