1

Using C# I want to detect whether foxit reader is installed on a windows machine. How can I achieve this?

Thanks in advance for your help.

default
  • 11,485
  • 9
  • 66
  • 102
Hamza Ahmed
  • 1,571
  • 4
  • 18
  • 35

3 Answers3

1

Answer is here. You should look through registry and find the name "foxit reader"

Community
  • 1
  • 1
Dmitrii Dovgopolyi
  • 6,231
  • 2
  • 27
  • 44
  • Strangely enough @Dmitry I opened up regedit on my machine and manually iterated through the list but could not find an entry for foxit reader although I have foxit reader 64 bit installed on my machine. So is this method foolproof? – Hamza Ahmed Sep 20 '12 at 12:36
  • Did you look in "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" in both current user and local machine? And in @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"? – Dmitrii Dovgopolyi Sep 20 '12 at 12:59
  • I finally found it in this location @"HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Foxit Reader_is1" @Dmitry. I'm wondering whether this is an arbitrary location or a 64 bit installation of foxit always installs it's registry keys here? Now what about 32 bit machines? Or should I iterate through all the locations that you've indicated and check for the DisplayName/Install Location? – Hamza Ahmed Sep 20 '12 at 13:18
  • I think 32 bit machines don't have Wow6432Node node at all and you should iterate through all the locations to check the installation – Dmitrii Dovgopolyi Sep 20 '12 at 13:24
  • Wow6432Node is where all 32bit applications in 64bit systems write their data – Dmitrii Dovgopolyi Sep 20 '12 at 13:28
  • On a related note @Dmitry how can I detect in C# if a windows machine is 32 bit or 64 bit? – Hamza Ahmed Sep 20 '12 at 13:38
  • http://stackoverflow.com/questions/336633/how-to-detect-windows-64-bit-platform-with-net – Dmitrii Dovgopolyi Sep 20 '12 at 13:57
0

I would do the following:

  • Take a blank machine.
  • Install FoxIt Reader.
  • Look where it has been installed.
  • Use the File.Exists function together with Environment.GetSpecialFolder to check for the executable to be present.

Alternatively, if the path may vary where it has been installed, you could:

  • Take a blank machine.
  • Install FoxIt Reader.
  • Look for Registry keys that have been added.
  • Use the RegistryKey functions to check for existance of related keys.
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
0

Files could be installed incorrectly. The same applies for registry keys that are stored by the Application itself. A File.Exists does not actually indicate it has been installed (and registered as a viewer).

I would personally check the Windows Installer database for the Product. checking the uninstall registry is a possible approach, however you can also invoke MsiQueryProductState using windows API calls.

Community
  • 1
  • 1
Myrtle
  • 5,761
  • 33
  • 47