-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
cevem
That's great article.
I have a question. How to find executable location of the programs? Thanks.
There isn't any way that I know of. I know we all like to think that an installed program has a "main" EXE file but at the end of the day an installed program can be any number of EXEs (maybe even none at all) so Windows does not have any relation between an entry in Add/Remove Programs and actual EXE's (other than the location of the uninstaller for that program). If anyone finds a way to do it I would be interested to hear how, but as far as I know it is not really possible.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
chris128
Those programs are programs that have been installed by a Windows Installer (MSI) setup program. For each of the registry keys under that location you mentioned, my code checks to see if they have the WindowsInstaller value within them set to 1, if they do then we just get the name of the key (so{DJFHDFH34} for example) and pass it to our GetInstallerKeyNameFromGuid function which takes the name and works out the MSI installer ID for it (which is done by just moving some of the characters around, just look at the function to see exactly what it does). Then we look for that MSI installer ID in another part of the registry (HKEY_CLASSES_ROOT\MSI_installer_ID_here) to actually get the program name and other information.
This is the part of the code that does it (within the GetUninstallKeyPrograms method):
vb.net Code:
If Not CInt(CurrentSubKey.GetValue("WindowsInstaller", 0)) = 1 Then
'...
'... irrelevent code here
'...
Else 'If WindowsInstaller
Dim ProgVersion As String = String.Empty
Dim Name As String = String.Empty
Dim FoundName As Boolean = False
Try
Dim MsiKeyName As String = GetInstallerKeyNameFromGuid(SubKeyName)
Dim CrGuidKey As RegistryKey = ClassesKey.OpenSubKey(MsiKeyName)
If Not CrGuidKey Is Nothing Then
Name = CStr(CrGuidKey.GetValue("ProductName", String.Empty))
End If
Catch ex As Exception
Debug.WriteLine(SubKeyName & " - " & ex.Message)
End Try
Hope that explains it - I know its not very straight forward, that's why it took me ages to figure it out and get this code working :)
Now it is clarified, Thanks!
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Chris,
I know that in the sub-directories in the following paths most programs have an 'installdate' key associated with them:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
Would you be able to give me some instructions on how to query the 'installdate' reg key and return that as well (similar to calling program.displayname & program.version? i.e. so I can return program.installdate
What parts of the code do I need to add to in order to be able to grab that?
I would find this very useful.
Thanks in advance, your help is always appreciated!
-Drew
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
well, I think I figured it out, was easier than I thought. :)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi Chris128, Thanks for this example works brilliantly, My code was only getting half of the apps.
I have chopped out alot of code as I didn't require it for this project as its an automated program to get details from the local machine (no updates).
It all works brilliantly I have the Target cpu set to Active (any CPU) however one small problem which isn't a big deal is the duplication of the odd few programs.
This is not a problem for us and I noticed someone else mentioned it but also mentioned it worked fine after they set it to Any CPU.
Not a problem just thought I would bring it up. But well done on the great coding :-)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Thanks :) surprised to hear you are getting duplicats though when you are compiling to AnyCPU as I've been using this code for months on loads of machines and not found any machines where it does not produce an identical list to Add/Remove Programs. Are you sure you didn't change something when you were chopping out the bits that you don't need? Or maybe these machines have multiple versions of these programs installed?
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
This is really awsome..
I was using my own script, with additional scripts found elsewhere, but this handles it all!!
Very nice..
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
ok everyone seems to be asking about the icon thing...
its really cake to do, and I wanted that feature as well so I put it in...
now as perfect as this solution seemed (unghhhhh!), it wasnt really what i wanted after all.. but chris u definately put me in the right path.. like sum1 mentioned B4, what i really wanted was the path to the executables, and didnt want bundles (such as office, or adobe cs3), but rather an itemized account of the exe's in those bundles (word, excel, ect.).. so using your structure (nicely done with the Ienum, i guess i dont know as much as i thought i did) i will search the start menu, and program files folder, and possibly system32 for any & all exe. when i finish, following tradition, i will post in new thread. Now for the icon matter this is how i did it:
in the properties region add:
vb Code:
Private _IconPath As String = String.Empty
''' <summary>
''' If this program specifies an icon file, it's path will be returned
''' </summary>
Public Property IconPath() As String
Get
Return _IconPath
End Get
Set(ByVal value As String)
_IconPath = value
End Set
End Property
in the constructors region change second sub to:
vb Code:
Public Sub New(ByVal ProgramDisplayName As String, ByVal ProgramParentDisplayName As String, ByVal IsProgramUpdate As Boolean, ByVal ProgramVersion As String, ByVal ProgramIconPath As String)
Me.DisplayName = ProgramDisplayName
Me.ParentDisplayName = ProgramParentDisplayName
Me.IsUpdate = IsProgramUpdate
Me.Version = ProgramVersion
Me.IconPath = ProgramIconPath
End Sub
in the GetUserInstallerKeyPrograms function edit to the following:
vb Code:
If Not CInt(UserDataProgramKey.GetValue("SystemComponent", 0)) = 1 Then
Dim Name As String = CStr(CuInstallerKey.OpenSubKey(CuProductGuid).GetValue("ProductName", String.Empty))
Dim ProgVersion As String = String.Empty
Dim ProgIcon As String = String.Empty
Try
ProgVersion = CStr(UserDataProgramKey.GetValue("DisplayVersion", String.Empty))
ProgIcon = CStr(UserDataProgramKey.GetValue("DisplayIcon", String.Empty))
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
If Not Name = String.Empty AndAlso Not IsProgramInList(Name, ExistingProgramList) Then
ExistingProgramList.Add(New InstalledProgram(Name))
ProductFound = True
End If
End If
in the GetUninstallKeyPrograms function edit to the following:
vb Code:
If IncludeUpdates Then
'Add the program to our list if we are including updates in this search
Dim Name As String = CStr(CurrentSubKey.GetValue("DisplayName", String.Empty))
Dim IconP As String = CStr(CurrentSubKey.GetValue("DisplayIcon", String.Empty))
If Not Name = String.Empty AndAlso Not IsProgramInList(Name, ExistingProgramList) Then
ExistingProgramList.Add(New InstalledProgram(Name, CStr(CurrentSubKey.GetValue("ParentDisplayName", String.Empty)), True, ProgVersion, IconP))
End If
End If
and still in the GetUninstallKeyPrograms function edit to the following:
vb Code:
If UninstallStringExists Then
Dim Name As String = CStr(CurrentSubKey.GetValue("DisplayName", String.Empty))
Dim IconP As String = CStr(CurrentSubKey.GetValue("DisplayIcon", String.Empty))
If Not Name = String.Empty AndAlso Not IsProgramInList(Name, ExistingProgramList) Then
If Not IconP = String.Empty Then
End If
ExistingProgramList.Add(New InstalledProgram(Name, CStr(CurrentSubKey.GetValue("ParentDisplayName", String.Empty)), False, ProgVersion, IconP))
End If
End If
and still in the GetUninstallKeyPrograms function edit to the following:
vb Code:
Else 'If WindowsInstaller
Dim ProgVersion As String = String.Empty
Dim Name As String = String.Empty
Dim FoundName As Boolean = False
Dim IconP As String = String.Empty
Try
Dim MsiKeyName As String = GetInstallerKeyNameFromGuid(SubKeyName)
Dim CrGuidKey As RegistryKey = ClassesKey.OpenSubKey(MsiKeyName)
If Not CrGuidKey Is Nothing Then
Name = CStr(CrGuidKey.GetValue("ProductName", String.Empty))
IconP = CStr(CrGuidKey.GetValue("DisplayIcon", String.Empty))
End If
Catch ex As Exception
Debug.WriteLine(SubKeyName & " - " & ex.Message)
End Try
Try
ProgVersion = CStr(CurrentSubKey.GetValue("DisplayVersion", String.Empty))
IconP = CStr(CurrentSubKey.GetValue("DisplayIcon", String.Empty))
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
If Not Name = String.Empty AndAlso Not IsProgramInList(Name, ExistingProgramList) Then
ExistingProgramList.Add(New InstalledProgram(Name, CStr(CurrentSubKey.GetValue("ParentDisplayName", String.Empty)), False, ProgVersion, IconP))
End If
End If
Now in your form get the icons as follows:
vb Code:
Private Sub GetProgramsFinished(ByVal InstalledPrograms As List(Of InstalledProgram))
If Not InstalledPrograms Is Nothing Then
For i As Integer = 0 To InstalledPrograms.Count - 1
If InstalledPrograms(i).IsUpdate = False Then
Dim theIcon As Icon
Dim theIconPath As String
Try
If Not InstalledPrograms(i).IconPath = Nothing Then
If InstalledPrograms(i).IconPath.IndexOf(",") > 0 Then
theIconPath = InstalledPrograms(i).IconPath.Substring(0, InstalledPrograms(i).IconPath.IndexOf(","))
Else
theIconPath = InstalledPrograms(i).IconPath
End If
theIcon = System.Drawing.Icon.ExtractAssociatedIcon(theIconPath)
Else
theIcon = My.Resources.error_icon1
End If
Catch ex As Exception
theIcon = My.Resources.error_icon1
End Try
ProgDataGridView.Rows.Add("", theIcon, InstalledPrograms(i).DisplayName)
Me.ProgDataGridView.Refresh()
End If
Next
End If
Me.Enabled = True
If ProgDataGridView.Rows.Count = 1 Then
MessageBox.Show("No programs were found - this could be because there were no programs installed on the computer (that is not very likely really though is it)." & vbNewLine & _
"Try again... ", "Ooops", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Else
End If
End Sub
this will get u almost all icons, and puts one in its place where it didnt find an icon. Im not going to perfect this, as im going a slightly different route based on chris's solution... but should help point yall in the right direction...
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Cool thanks for posting that, I'm sure it will help others out :) The only reason I didn't add the icons originally is because this is intended to be usable against remote PCs and in that situation your code (which is the same as how I would have done it) wont work. If you only ever intend for this code to get programs from the machine it is running on then obviously that is not an issue :)
Oh and you said it gets almost all icons - are there any that it doesn't get that do actually appear in Add/Remove Programs? I'm assuming there is and that these are icons where the file pointed to by the DisplayIcon registry value contains more than one icon, as you are just using ExtractAssociatedIcon which doesn't have any option to get a specific icon from the file. If you are bothered about this, you might want to try using the NativeIcon.GetIconAtIndex method from my Windows API library (download link in my signature) as this will let you get an icon at a specific index from the specified file (I believe the DisplayIcon registry values specify the index number of the icon that should be used after the file name)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
gotcha...
yea thats not the case with me....
the reason for me gettin involved in this whole mess is due to the development of a small app that requires list of installed progs in local pc, but the path of itemized exe's is an integral and essential part..
:) thanks again for sharin... a little moddin and i devote more time to the rest of the app instead...
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
some.. 7zip icon does not show in either, but clipmagic icon shows in add/remove...
ur edit should do the trick.. and while using ur edit the user should remove/alter the line that i used to search for icons with index values, and remove the index.. utorrent didnt seem to care and the icon displays, but the others wont..
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Ah yeah, you mean this bit:
Code:
If InstalledPrograms(i).IconPath.IndexOf(",") > 0 Then
theIconPath = InstalledPrograms(i).IconPath.Substring(0, InstalledPrograms(i).IconPath.IndexOf(","))
Else
theIconPath = InstalledPrograms(i).IconPath
End If
Anyway, glad the code helped you out a bit even if it wasn't 100% what you were looking for :)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
I am new to vb and I love your code, it looks awesome and I want to know how can I also pull the system information from the remote pc. Things like computer type ram, hard disk, ect. I want to put it on the same page. Can you assist?
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
You should be starting a new thread not replying to this one.
This is exactly what I am working on at the moment for our Internal Asset Management system. There are two ways to go about it:
1: (The route we are taking): Have a client peice of software on each machine that collects details and sends back to a central server. Useful if you just want a database of machines with details - this method can also get alot of information.
2: Use Remote WMI to get the information you want. Note you will need permissions to access the other machine. I have used remote WMI but only within a Domain Environment and I have Domain Admin rights.
There is probably other methods but these are the two ones that jump out at me.
Hope this helps. If you want to discuss it further create a new thread in the vb.net forum.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Thanks I posted a new thread to show you what I am looking for.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
max_carpenter
2: Use Remote WMI to get the information you want. Note you will need permissions to access the other machine. I have used remote WMI but only within a Domain Environment and I have Domain Admin rights.
Yeah WMI can be a little unreliable because a lot of admins don't allow it through their workstation's firewalls or simply disable the WMI service.
The other method that I have used in the past is a variation on your first method - rather than having a piece of software actually installed and always running on the workstations, we just run the program from a network share via logon script that is assigned to all users. This way it runs whenever anyone logs on to a PC (so we also get a record of when anyone logged on and which PC they logged on to) and updates the general system info in a central SQL database
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
That is similar to what I have built (and currently rebuilding) at my place although it doesnt run with logon scripts.
My old package ran as a windows service on each local machine and got all the information I required including last logged on user and lots of WMI information then compiled an XML sent it back to the server for a server service to read the xml and enter it into the database.
The new one is slightly differnts its a windows forms app that runs on startup for every user, still collects all the same information but then connects to the server using sockets to send all the info back. The reason its a windows forms app because italso acts as a server monitor for users to see status of all our services and for us to display messages to the user etc.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Yeah I do like the idea of having an app like that, that we could send messages to the users through or send it the path to a script/program to execute, but I always wonder about the security risks. I mean if you have an app that accepts incoming connections that give it commands to execute, it would be very easy for an attacker to exploit and make it do whatever they wanted, if you didn't have some decent security built in (more than just a hard coded password because someone could just decompile your client side app to see what the password is that it checks for). I know the probability of anyone actually trying to exploit a bespoke app you've written is very slim but I just think if it ever did happen I would be in so much trouble if someone found out my application had put every user's computers at risk (and therefore the entire company's data) that its just not worth it. Plus, we use MS SCCM now so we can just use that to push out apps and scripts etc and it collects a fair bit of information from the workstations too, even down to when they last ran each EXE on their PC which comes in handy for identifying who isn't using software that we pay for licenses for so that we can redistribute that license instead of having to buy a new one :)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
That does sound handy.
As for the bespoke app not only as you mention is it very very slim that someone will exploit it especially as its not out in the public for anyone to find but with our one it only accepts pre-programmend commands and not scripts or windows commands etc.
For instance it is programmed to accept the commands
SCAN
LOCATE
UPATE
AVSCAN
MESSAGE
etc
But I couldn't say run the following:
C:\tmp\MyScript.bat
My program would just see that as an error and disconnect the session.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Yeah that's fine and certainly secure, I just think it would be really useful with an app like that to be able to tell it to launch a custom action (e.g a script or executable) so that you don't have to recompile and redeploy the app whenever you want it to do something that it doesn't already do.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
This code is great!... but with Server 2008 onward, Microsoft has changed the way the OS reports Installed Updates.
After some research, I'm able to get the non-OS Installed Updates (MS Office hotfixes, SQL Server Service Packs) using this code:
(This goes inside Private Shared Function InternalGetInstalledPrograms, between the lines "Next" and "'Close the registry keys")
Code:
'-- Windows 2008 - JFoushee (2/2012)
Dim key As RegistryKey = HklmPath.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion\")
Dim strTemp As String = key.GetValue("CurrentVersion").ToString()
If IsNumeric(strTemp) Then
Dim dblReturn As Double = Convert.ToDouble(strTemp)
If dblReturn >= 6.0 Then
'-- Windows 2008 non-QFE Patches
Dim Win2K8PatchKey As RegistryKey = HklmPath.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products")
ProgramList = Get2008NonQFEPatches(Win2K8PatchKey, HklmPath, ProgramList)
'not sure how to get QFEs by Registry
End If
End If
and this is a new function to go in the "Private Methods" region:
Code:
Private Shared Function Get2008NonQFEPatches(ByVal SystemKey As RegistryKey, ByVal HklmRootKey As RegistryKey, ByVal ExistingProgramList As List(Of InstalledProgram)) As List(Of InstalledProgram)
' addition provided by JFoushee (2/2012). No warranties/guarantees.
If Not SystemKey Is Nothing Then
Dim LmProductGuids() As String = SystemKey.GetSubKeyNames
For Each LmProductGuid As String In LmProductGuids
Dim InstallPropKey As RegistryKey = HklmRootKey.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" & LmProductGuid & "\InstallProperties")
If InstallPropKey IsNot Nothing Then
If Not CInt(InstallPropKey.GetValue("SystemComponent", 0)) = 1 Then
Dim ParentName As String = CStr(InstallPropKey.GetValue("DisplayName", String.Empty))
Dim Vendor As String = CStr(InstallPropKey.GetValue("Publisher", String.Empty))
Dim PatchesKey As RegistryKey = HklmRootKey.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" & LmProductGuid & "\Patches")
If PatchesKey IsNot Nothing Then
Dim LmPatchGuids() As String = PatchesKey.GetSubKeyNames
For Each LmPatchGuid As String In LmPatchGuids
If Not CInt(PatchesKey.OpenSubKey(LmPatchGuid).GetValue("State", 1)) = 2 Then
Dim Name As String = CStr(PatchesKey.OpenSubKey(LmPatchGuid).GetValue("DisplayName", String.Empty))
Dim InstallDate As String = ""
Try
InstallDate = CStr(PatchesKey.OpenSubKey(LmPatchGuid).GetValue("Installed", String.Empty))
Catch ex As Exception
End Try
If Not Name = String.Empty AndAlso Not IsProgramInList(Name, ExistingProgramList) Then
ExistingProgramList.Add(New InstalledProgram(Name, ParentName, True, "1", Vendor, "", "", InstallDate))
End If
End If
Next
End If
End If
End If
Next
End If
Return ExistingProgramList
End Function
Now, if someone could figure out the Windows 2008 OS-level hotfixes from the Registry...
(Yes, I 'could' use WMI's Win32_QuickFixEngineering... but then I have two security points-of-failure if someone blocked WMI access.)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Cool thanks for the additions - I never spent much time on getting the updates (as mentioned in the original post) so even on XP it wasn't giving the correct results for that, as I was only ever really bothered about getting the installed programs rather than installed updates.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Miss list of update which have a "This update cannot be removed" info type.
http://img824.imageshack.us/img824/6...edprograms.jpg
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Is there a way to get more information about each product such as the publisher(or vendor) and installed location
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
Midomoi
Yeah like I said, I didn't spend much time on getting the update detection to work properly cos I was only interested in programs not updates
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
WishWell
Is there a way to get more information about each product such as the publisher(or vendor) and installed location
Yep, and I think someone else already asked in this thread about it. Just look at the source code and find the places where it is getting values like UninstallString, Version, SystemComponent etc etc from the registry and in there you need to get the Vendor value (or whatever its called, look in your own registry to find out).
-
2 Attachment(s)
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi!
I'm trying this one to check for OS Hotfixes(updates) that are installed on my machine. I found out that there are some missing updates and duplicate entry.
Duplicate:
Attachment 90495
Missing:
Attachment 90497
Anyway, Cool app! :D
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi Chris128,
Firstly, this app is really awesome! It helps me a lot when i need to trace what apps was installed in the labs.
I have questions here, still using the 'UserDataKeyName' and im interested to populated the 'publisher' of all apps installed and how could we do so? if possible, i need to flag with a check box like what you did for 'include updates' and 'only show updates'.. then the 'publisher' data will shown in the Forms.ListView
Can you help with this?
Hope to hear from you soon.
Thanks!
kitrafael
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
jmb555
Hi!
I'm trying this one to check for OS Hotfixes(updates) that are installed on my machine. I found out that there are some missing updates and duplicate entry.
Duplicate:
Attachment 90495
Missing:
Attachment 90497
Anyway, Cool app! :D
Yeah like I've said before, I didn't really ever concentrate on the update side of things as I only ever wanted the list of programs (not updates) - that was just a bonus really because it looked like it was fairly easy to do, but evidently its not working quite right. If you want it to reliably get all of the updates installed then you'd have to look at the code and see where it is going wrong and why it is picking up duplicates
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
kitrafael
Hi Chris128,
Firstly, this app is really awesome! It helps me a lot when i need to trace what apps was installed in the labs.
I have questions here, still using the 'UserDataKeyName' and im interested to populated the 'publisher' of all apps installed and how could we do so? if possible, i need to flag with a check box like what you did for 'include updates' and 'only show updates'.. then the 'publisher' data will shown in the Forms.ListView
Can you help with this?
Hope to hear from you soon.
Thanks!
kitrafael
Like I've said before in this thread, if you want to get the publisher then just change the code so that as well as reading the DisplayName and Version registry values it also reads and stores the Publisher value. If you follow the code through its fairly obvious where it is actually reading and storing the display name and version values so just add another line in there to grab the publisher value.
EDIT: wow over 5000 downloads of this library now (and not many complaints). Hope it is helping people out :)
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
1st thanks a bunch chris128 its a great program. Thanks again. I have a question is it possible if I want to know 2-3 specific program such as microsoft office is it intalled or not , adobe pdf is installed or not?
If so can you please provide sample code ?
Best regards
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Just loop through the list that my code gives you and check to see if it contains the program you are looking for. I'm not going to show you how to loop through a list, because that's very basic programming and if you're unsure how to do things like that then you should go through a few beginners tutorials
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Now is there a way to remove programs from this? I wonder how you could do that?
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi Chris,
I looked into your example and working like exactly like Windows (I would say more better then windows because windows sometimes duplicates programs whereas your program didn't).
But I have one problem, code is in VB.Net. I like to do same thing in c#. but when I convert your code from vb.net to c# (using online conversion tool) it gives wrong output in c# version. I compared both code it is same way written in c#. but although don't know why it is not correctly working. It would be great if you can upload C# version.
I can't you DLL of your code (I gives prefect in c# if I use VB.Net dll). I need that class to be in c#.
Any help appreciated.
Regards,
Sachin
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
sachinnpanchal
Hi Chris,
I looked into your example and working like exactly like Windows (I would say more better then windows because windows sometimes duplicates programs whereas your program didn't).
But I have one problem, code is in VB.Net. I like to do same thing in c#. but when I convert your code from vb.net to c# (using online conversion tool) it gives wrong output in c# version. I compared both code it is same way written in c#. but although don't know why it is not correctly working. It would be great if you can upload C# version.
I can't you DLL of your code (I gives prefect in c# if I use VB.Net dll). I need that class to be in c#.
Any help appreciated.
Regards,
Sachin
Sorry I don't really know C# at all so can't help you. You'd probably be better off asking on a C# forum than a VB forum ;)
-
1 Attachment(s)
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi Chris,
I resolved problem in C# code. it was a problem in reverse function. If any one wants see please download attachment.
One more thing chris, I want to develop one small utility to find out problems in Registry like (CCleaner). Do you any idea for this kind of thing?
Any help would be appreciated.
Regards,
Sachin
Attachment 95871
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
sir,need help for our thesis pruposal, we need to scan installed software from a network in just one clicking the scan button,,
can u help us? we cant find codes, we search night and day but we got lost:(
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Thanks for the code, it is very helpful.
I understand that it takes information from the registry, which only contains program name. But is there any possible way to get also the executable path? Thanks!
-
1 Attachment(s)
Re: Example of how to enumerate installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
SuperJohn
can u use this to uninstall programs? like in xp when you double click the program?
icons would be cool too
Just to say thanks for the code, I am not a vb wizard, but changed the test program a bit to include the uninstal strings, and added a sample program to uninstall 1 program based upon its display name.
-
Re: Example of how to enumerate installed programs (like Add and Remove Programs)
Quote:
Originally Posted by
stefan52a
Just to say thanks for the code, I am not a vb wizard, but changed the test program a bit to include the uninstal strings, and added a sample program to uninstall 1 program based upon its display name.
O yeah, forgot to tell works fine in windows 8.1 as well, but have to run as administrator.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Wow, this is fast and works in Windows 10 if you Run As administrator. Unfortunately, for about 25% of my programs, it doesn't return the version number even though I can see the version number in the normal Apps & Features program list.
The values can be found in
Code:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
and I recommend retrieving them from there. I checked and, in all cases where it was missing from what your program showed me, the version information could be found in the above registry section.
-
Re: Example of how to get a list of installed programs (like Add and Remove Programs)
Hi there. I'm Arthur Dent, like the thousands of others with that name. I used to code in VB6 now I'm teaching myself VB.Net.
I've had an app idea using the code from Chris128, I thought I'd share with you. Just check the list to see if there are any games in there, by comparing each item to a list of Windows games.
From there on in, I could probably get the path to the executable, if the game properly registered itself with Windows.
Before all that, I've got some exercises to do from the book I've just read.
Anyway, nice to make your acquaintances!
PS. Does anyone ever "Add software" using that interface? I've never used it like that..Arthur.