Thursday, November 22, 2007

Fixing the "Reinstall Your App" Problem

Have you ever installed a new application only to find that running an old application now brings up a dialog asking to install it or a completely different application? That happens because when updated ActiveX controls are installed, their InprocServer settings in the Windows Registry, which points to the physical location of the OCX file, are overwritten with Windows Installer encrypted keys. When you run an older application that uses those ActiveX controls, Windows Installer thinks there’s something wrong with the ActiveX control and so prompts you to reinstall the application. This is a common conflict between VFP applications using ActiveX controls like the TreeView and Microsoft Office, for example.

This problem doesn't occur if you use Inno Setup instead of Windows Installer-based tools such as InstallShield. In the mean time, the workaround is to find the Registry entry for the ActiveX control and fix its InprocServer32 entry. This is easier said than done, because you don't necessarily know which control to fix; you need to find entries for all the controls your app uses. Here's how you do this:
  • Launch RegEdit.
  • Find "treeview" or whatever control you're looking for. The entry you want is in HKEY_CLASSES_ROOT\CLSID and it'll be a GUID. For example, for the TreeView control version 6, the entry is HKEY_CLASSES_ROOT\CLSID\{C74190B6-8589-11D1-B16A-00C0F0283628}.
  • Look in InprocServer32 for the InprocServer32 key. It's supposed to contain the name and path for the OCX, but notice it contains gibberish; that's the Windows Installer encrypted key that's causing the problem.
  • Edit the value and replace it with the name and path for the OCX; for the TreeView control, it should be C:\Windows\System32\MSComCtl32.OCX (the "(default)" value contains this, so you can copy it from there and paste it into InprocServer32).
  • Repeat for each of the controls your app uses.

1 comment:

Anonymous said...

Thanks for the pointer to the location in the registry. This one has been bugging me off and on for ages and occasionally still does and did so just yesterday. At least I have a solution now.