您的位置:首页 > 其它

Listing All The Installed Softwares In Computer Using .Net

2012-04-01 20:34 567 查看
We will be Accomplishing using the Windows Registry.

Main Registry to work here is : "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"

Just Write Down The Following Code the Form's Loading Event (Form Contains No Control):

C#.NET


VB.NET

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim SoftwareKey As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products"
Dim rk As RegistryKey
rk = Registry.LocalMachine.OpenSubKey(SoftwareKey)
Dim skname As String
Dim sname As String = String.Empty

Dim ListView1 As New ListView
Me.Controls.Add(ListView1)
ListView1.Dock = DockStyle.Fill

ListView1.View = View.Details
ListView1.Columns.Add("Installed Software")

For Each skname In rk.GetSubKeyNames
Try
sname = Registry.LocalMachine.OpenSubKey(SoftwareKey).OpenSubKey(skname).OpenSubKey("InstallProperties").GetValue("DisplayName")
ListView1.Items.Add(sname)
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next

ListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)

End Sub


Output:



Downloads:

vb.net : Download
c#.net : Download
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐