Delphi 7 Type Library Import failing with “error accessing the OLE registry”

delphidelphi-7

Can anyone throw any light on an apparent partial incompatibility between TLibImp in Delphi 7and Win7 64-bit? Or suggest a less long-winded work-around than the one below?

I realise D7 is a bit long in the tooth, btw, but otherwise its IDE seems to behave faultlessly in Win7, which I suppose is a testament to MS's efforts on backwards compatibility.

Looking into another SO question earlier, I tried to use it to import ActiveDS.Tlb from \Windows\SysWOW64 using Project | Import Type library, but got an "Error accessing the OLE registry" error. I got the same error trying the copy in System32. Trying to import ActiveDS.Dll from both places I got "Error loading type library" instead.

I tried all the things which people say in the MS communities to try (Run Delphi as Administrator, Disable UAC, etc) and which David Heffernan told me (correctly) that I needn't do when I ran into the "Error accessing the OLE registry" error when I mistakenly tried to import a type library into XE4 the wrong way.

Otoh, on Win7 64-bit, D7 imports the type library for Adobe Acrobat and many others without complaint.

I managed to work around the problem by importing the ActiveDS.Tlb using XE6 and editing out the unit namespace prefixes, fwiw.

Also, I seem to recall but can't currently find a fix for one of the supplied units (ComObj maybe) for D5/D7
to avoid getting this error when a Delphi application started up which was caused by something like a problem in the way the COM object factory was initialized. But unfortunately, unlike some of the other Delphi utilities like TRegSvr, the source for TLibImp isn't supplied

Best Answer

There's not much to say here. Type library importing is a recurring problem area. Sometimes old versions of Delphi will import the libraries when new versions will not. And sometimes vice versa, as you have encountered. The type library importer has bugs, that's the long and the short of it.

Your workaround is the most effective way to deal with such problems. There's no point submitting a QC report because the problem is fixed in the latest version.

Related Topic