SoFunction
Updated on 2025-03-01

C# implements the method of reading the registry to monitor the changes in the installed software of the current operating system

This article describes the method of C# to read the registry and monitor the changes in the installed software of the current operating system. Share it for your reference. The specific implementation method is as follows:

private static HybridDictionary GetSoftName()
{
 string strSoftName = ;
 HybridDictionary hdSoftName = new HybridDictionary();
 /*Operate the contents of the registry node "Software/Microsoft/Windows/CurrentVersion/Uninstall".
  RegistryKey Registry is the registry operation class*/
 using (RegistryKey key = (@"Software\Microsoft\Windows\CurrentVersion\Uninstall", false))
 {
  if (key != null)
  {
   foreach (string keyName in ())
   {
    using (RegistryKey key2 = (keyName, false))
    {
     if (key2 != null)
     {
      string softwareName = (("DisplayName"));//Get DisplayName. If a value exists, the software is installed in the system.      //string installLocation = ("InstallLocation", "").ToString();//Software installation path      if (!(softwareName))
      {
       if (!(softwareName))
       {
        (softwareName, );//Prefer software name as the key of the collection       }
      }
     }
    }
   }
  }
 }
 return hdSoftName;
}

I hope this article will be helpful to everyone's C# programming.