Questions and Answers about ProgID in Active X controls

Date:Archived
Product/Release:Visual LANSA
Abstract:Q&A on ProgID in ActiveX controls
Submitted By:LANSA Technical Support

In a VL Active-X component for MS-Excel I use Progid('Excel.Application.8').

On some of the my development systems this line will not compile with a message that no component with Progid Excel.Application.8 is enrolled.

If I change Progid('Excel.Application.8') to Progid('Excel.Application') it all seems to be okay.

What exactly does leaving the .8 off the end mean?

There is a special registry entry called VersionIndependentProgID. This is the same as ProgID except for the .version . This registry key must always point to the latest version. It can be used to always instantiate the latest version of an active-X component.

Is this good practice?

This is generally used by scripting languages, since they are late-bound to the component. In general as long as the methods used are not from a later version (ie the lowest common denominator is used), then there should not be an issue, as it is mandatory for COM components to be interface / semantically backwards compatible (of course semantics are the hardest to keep backwards compatible). VL does not currently late bind Active-X references (they are bound at compile time) but by using the Progid('Excel.Application') format rather than the Progid('Excel.Application.8') format you are binding to the latest version available on the system. 

Does it mean use the latest available?

Correct.

Are there ramifications in doing this?

Some of the ramifications are if a developer used a later version of the component to code against, and used some methods that are only available in the later version, and specified a VersionIndependentProgID instead of the versioned one, then when the application is run on the box that has an earlier version with newer methods missing, a runtime error would result, as the newer methods would not be resolved. This is no different to how scripting languages would behave (except for the fatal error of course).

What about other controls such as Word and MAPI .... do they use the same sort of rules/conventions?

Yes. The VersionIndependentProgID is a standard from MS. Obviously, it is possible that some components are not good, but most are.