ProgIds ExplainedCOM makes heavy use of the Windows registry and requires all COM components to register information about themselves within the registry before clients (i.e WinBatch ) can access their services. To ensure different components do not clash, COM uses globally unique identifiers (known as GUIDs) which are computed using a special algorithm. A COM component class can be accessed via its programmatic identifier (referred to as its ProgID). This is a name constructed from the type library name and class 'Name' attribute separated by a period e.g. 'MyApp.MyClass'. The WinBatch 'ObjectCreate' command takes a ProgID as one of its parameters to create an instance of an object. Information about a COM component's classes, their interfaces, methods, properties are typically stored in a type library and can be referenced by the WIL Type Viewer. This information is used by the WIL Type Viewer to display information and component details. For the most part, many COM components follow these rules but there are many exceptions. For example if you type 'htmlfile' in the Wil Type Viewer and click 'Get Members' or 'Get Library'. You'll note that is NOT a name constructed from the type library name and class 'Name' attribute separated by a period e.g. 'MyApp.MyClass'. Windows RegistryWhen an ActiveX component is registered on a machine, a number of registry entries are created. For example, consider an ActiveX DLL component containing a public class called 'AXTest' with a public method name 'TestMethod1' and the project name 'ProjTest'. When the component is deployed to 'C:\Program Files\Test' and registered, a number of entries are written under HKEY_CLASSES_ROOT as follows (not all entries are shown): CLSID {E2366527-7621-4CB3-BC1B-7527C167BD23} InprocServer32 (Default) REG_SZ C:\Program Files\Test\ProjTest.dll ThreadingModel REG_SZ Apartment ProgID (Default) REG_SZ ProjTest.AXTest TypeLib (Default) REG_SZ {62166784-093E-498F-BDE0-C8DAF8CB40A6} Interface {B36EE049-7504-4047-BA93-684A2380A820} ProxyStubClsid (Default) REG_SZ {00020420-0000-0000-C000-000000000046} ProxyStubClsid32 (Default) REG_SZ {00020420-0000-0000-C000-000000000046} TypeLib (Default) REG_SZ {62166784-093E-498F-BDE0-C8DAF8CB40A6} Version REG_SZ 1.0 TypeLib {62166784-093E-498F-BDE0-C8DAF8CB40A6} 1.0 (Default) REG_SZ Test Component 0 win32 (Default) REG_SZ C:\Program Files\Test\ProjTest.dll ProjTest.AXTest CLSID (Default) REG_SZ {E2366527-7621-4CB3-BC1B-7527C167BD23}
The WIL Type Viewer basically scans the 'HKCR\TypeLib' section of the registry. If a reference is selected then the WIL Type Viewer uses the value under the registry keys to locate the type library in the file system, which it then loads so that it can populate itself. Not all servers have external or registered type libraries. The Wil Type Viewer checks if any given server has a registered type library if it does it uses it to provide type information for the given progid. However, if the object does not, the Wil Type Viewer queries the instance of an object its type information. Some COM servers provide the type information from an internal unregistered type library other simply create the type information programmatically on the fly. Some servers have no type information at all. WMI is a good example of this. Duplicate Prog Ids ExplainedIMPORTANT! The WIL Type Viewer defaults to referencing the latest version of a type library. If you use an identifier *without* a version number suffix, you create an object in the most recent version of Excel available on the machine. For example ObjectCreate('Excel.Application') can either reference Excel.Application.9 or Excel.Application.8, depending on the latest version is installed on the system. When a DLL implements multiple versions of a control, it may have multiple classes that reference the same progid. Let us consider component registration in the registry. All version dependent ProgID's end with a period and the version number. For Example ProgidSample.ProgIDSample.1 ProgidSample.ProgIDSample.2 Yet, they have the same version independent ProgID's of ProgidSample.ProgIDSample The duplicate ProgID's can peacefully coexist even if all ProgID's (version independent and version dependent) in HKEY_CLASSES_ROOT\CLSID are the same.
|