How to check if Eikon is installed on user machine

Hello, I am an Eikon user. I am developing an application using the .NET API. I have a requirement to check if Eikon is installed on user machine. This is to set the market data source as users may have other sources.

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @rajeesh.r

    You can write a .NET application to get a list of installed programs. I found one solution in the StackOverflow.

    My code is:

            public void FindEikonOnHKCU()
            {
                Console.WriteLine("\nFind Eikon on the HKCU\n=================");
                string registry_key = @SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall;
                using (Microsoft.Win32.RegistryKey key = Registry.CurrentUser.OpenSubKey(registry_key))
                {
                    foreach (string subkey_name in key.GetSubKeyNames())
                    {
                        using (RegistryKey subkey = key.OpenSubKey(subkey_name))
                        {
                            if (subkey.GetValue("DisplayName") != null)
                            {
                                var name = subkey.GetValue("DisplayName").ToString();
                                if (name.Contains("Eikon"))
                                {
                                    Console.WriteLine(subkey.GetValue("DisplayName"));
                                }
                            }
                        }
                    }
                }
            }
            public void FindEikonOnHKLM()
            {
                Console.WriteLine("\nFind Eikon on the HKLM\n=================");
                //string registry_key = @SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall;
                string registry_key = @SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall;
                using (Microsoft.Win32.RegistryKey key = Registry.LocalMachine.OpenSubKey(registry_key))
                {
                    foreach (string subkey_name in key.GetSubKeyNames())
                    {
                        using (RegistryKey subkey = key.OpenSubKey(subkey_name))
                        {
                            if (subkey.GetValue("DisplayName") != null)
                            {
                                var name = subkey.GetValue("DisplayName").ToString();
                                if (name.Contains("Eikon"))
                                {
                                    Console.WriteLine(subkey.GetValue("DisplayName"));
                                }
                            }
                        }
                    }
                }
            }

    It looks for the Eikon application in the SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall key of the HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER registries.

Answers