Quote Originally Posted by Blagojce View Post
In registry under HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall I have keys which starts with "{some number" but application skip this keys and start with application name keys.
I search through the code,but didn't notice how you did this.
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:
  1. If Not CInt(CurrentSubKey.GetValue("WindowsInstaller", 0)) = 1 Then
  2. '...
  3. '... irrelevent code here
  4. '...
  5. Else   'If WindowsInstaller
  6.      Dim ProgVersion As String = String.Empty
  7.      Dim Name As String = String.Empty
  8.      Dim FoundName As Boolean = False
  9.      Try
  10.            Dim MsiKeyName As String = GetInstallerKeyNameFromGuid(SubKeyName)
  11.            Dim CrGuidKey As RegistryKey = ClassesKey.OpenSubKey(MsiKeyName)
  12.            If Not CrGuidKey Is Nothing Then
  13.                   Name = CStr(CrGuidKey.GetValue("ProductName", String.Empty))
  14.            End If
  15.      Catch ex As Exception
  16.            Debug.WriteLine(SubKeyName & " - " & ex.Message)
  17.      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