473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Getting a list of installed programs on windows using C#

Hi

I need some help here. I would appreciate it if any one can help me. My
2 questions is this:

1. How do you get a list of installed applications on Windows?
2. How do I get a program's description from a exe?
(Example - sqlservr.exe = Microsoft SQL Server 2000)

I am using C# with Visual Studio .net 2003. Thanks in advance...
Paul Horn
Pretoria
South Africa

Nov 17 '05 #1
5 43112
While not exactly programmatic, I’d suggest looking into Belarc Advisor
(http://www.belarc.com/free_download.html).

Brendan
"Paul Horn" wrote:
Hi

I need some help here. I would appreciate it if any one can help me. My
2 questions is this:

1. How do you get a list of installed applications on Windows?
2. How do I get a program's description from a exe?
(Example - sqlservr.exe = Microsoft SQL Server 2000)

I am using C# with Visual Studio .net 2003. Thanks in advance...
Paul Horn
Pretoria
South Africa

Nov 17 '05 #2
Try,
Microsoft.Win32.RegistryKey subKey1 =
regKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\C urrentVersion\\Uninstall");
string[] subKeyNames = subKey1.GetSubKeyNames();

foreach (string subKeyName in subKeyNames)
{
Microsoft.Win32.RegistryKey subKey2 = subKey1.OpenSubKey(subKeyName);

if (ValueNameExists(subKey2.GetValueNames(), "DisplayName") &&
ValueNameExists(subKey2.GetValueNames(), "DisplayVersion"))
{
listViewApps.Items.Add(new ListViewItem(new string[]{
subKey2.GetValue("DisplayName").ToString(),
subKey2.GetValue("DisplayVersion").ToString() }));
}

subKey2.Close();
}

subKey1.Close();

and...

private bool ValueNameExists(string[] valueNames, string valueName)
{
foreach (string s in valueNames)
{
if (s.ToLower() == valueName.ToLower()) return true;
}

return false;
}

Regards,
Phil.

"Paul Horn" wrote:
Hi

I need some help here. I would appreciate it if any one can help me. My
2 questions is this:

1. How do you get a list of installed applications on Windows?
2. How do I get a program's description from a exe?
(Example - sqlservr.exe = Microsoft SQL Server 2000)

I am using C# with Visual Studio .net 2003. Thanks in advance...
Paul Horn
Pretoria
South Africa

Nov 17 '05 #3
Forgot about the file description.

Try,

System.Diagnostics.FileVersionInfo fileVersionInfo =
System.Diagnostics.FileVersionInfo.GetVersionInfo( fileName);
string fileDescription = fileVersionInfo.FileDescription;

Regards,
Phil.

"Paul Horn" wrote:
Hi

I need some help here. I would appreciate it if any one can help me. My
2 questions is this:

1. How do you get a list of installed applications on Windows?
2. How do I get a program's description from a exe?
(Example - sqlservr.exe = Microsoft SQL Server 2000)

I am using C# with Visual Studio .net 2003. Thanks in advance...
Paul Horn
Pretoria
South Africa

Nov 17 '05 #4
Forgot to add this line at the beginning

Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.LocalMachine;

Regards,
Phil.

"Phil Williams" wrote:
Try,
Microsoft.Win32.RegistryKey subKey1 =
regKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\C urrentVersion\\Uninstall");
string[] subKeyNames = subKey1.GetSubKeyNames();

foreach (string subKeyName in subKeyNames)
{
Microsoft.Win32.RegistryKey subKey2 = subKey1.OpenSubKey(subKeyName);

if (ValueNameExists(subKey2.GetValueNames(), "DisplayName") &&
ValueNameExists(subKey2.GetValueNames(), "DisplayVersion"))
{
listViewApps.Items.Add(new ListViewItem(new string[]{
subKey2.GetValue("DisplayName").ToString(),
subKey2.GetValue("DisplayVersion").ToString() }));
}

subKey2.Close();
}

subKey1.Close();

and...

private bool ValueNameExists(string[] valueNames, string valueName)
{
foreach (string s in valueNames)
{
if (s.ToLower() == valueName.ToLower()) return true;
}

return false;
}

Regards,
Phil.

"Paul Horn" wrote:
Hi

I need some help here. I would appreciate it if any one can help me. My
2 questions is this:

1. How do you get a list of installed applications on Windows?
2. How do I get a program's description from a exe?
(Example - sqlservr.exe = Microsoft SQL Server 2000)

I am using C# with Visual Studio .net 2003. Thanks in advance...
Paul Horn
Pretoria
South Africa

Nov 17 '05 #5
Thanx Phil, I will have a look.

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pavel Koryakin | last post by:
Guys, does anybody knows how can I get a list of all windows which I see on my taskbar? Thank you. Pavel.
3
by: BobTheDatabaseBoy | last post by:
.... got: win2K, v8.1.6 login to win2K is to the network: user; bob13, domain; foo it's a win2K domain. i then login to my local db as db2admin. LIST APPLICATIONS fails with security error. ...
1
by: Paige W. | last post by:
I have added a mainmenu object to my windows form and would like to display an MRU list on it. Is there an easy way? or do I have to do it programatically? Can anyone point me to a good tutorial....
1
by: Ansari | last post by:
hi gurus; I m building an asp.net 1.1 application on Windows XP Machine. I m getting error message "SQL Server does not exists or Access Deined" when I want to establish connection to a sql...
1
by: Lars Netzel | last post by:
Hi How can I get list of the installed Programs on a computer in VB.NET code, I need to list them in an application I'm creating? best regards/ Lars Netzel
3
by: Klint Gore | last post by:
Does anyone know of a mailing list for application developers using postgres? It'd probably be more relevant than pgsql-general for my question. Failing that, what do people use to generate...
0
by: sandeepk84 | last post by:
Hi all... I am facing a problem in getting attachments from Yahoo Classic using JavaMail. My program reads the attachments from gmail and Yahoo Beta. But attachments of type pdf or txt from...
12
by: mdfidahussain | last post by:
hi, Can anyone help me out "how to get Version of Installed software product using VB Script" Thnx FH
2
by: yaddesh | last post by:
how can i detect installed sqlserver(s) using VB6
1
by: tarunsingh19 | last post by:
pls anybody tell me wether oracle 8i can be installed in windows xp sevice pack 2?or will it work in XP2, if yes then where we get this software free download file?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.