Why GUIDs Change On Every Recompile Of OLE Automation ServerLast reviewed: October 30, 1995Article ID: Q129869 |
The information in this article applies to:
SUMMARYWhen an application is compiled as an OLE Automation Server, the Interface identifiers (IIDs) and the Class identifiers (CLSIDs) used internally to uniquely identify an object's class and its properies and methods, change with every compile. This behavior is by design. This article explains why this is so and offers a workaround.
MORE INFORMATIONConsider two Visual Basic application instances, SRV and CTRLR. SRV is an OLE Automation Server and CTRLR is an OLE Automation Controller that has a reference to an object in SRV. If SRV shuts down and a major change (such as changing the name of a procedure or class, changing the number or type of the parameters, or removing a method) is made to it, CTRLR will still have a reference to the old type library and will bind to the old definition of the class. Thus CTRLR will now have an invalid reference to SRV. GUIDs always change on recompilation, in order to avoid such a scenario. In object applications, changes you make to existing procedures may cause the new version to be incompatible with previous versions. For example, you could change either the name of a procedure, the number of arguments passed to a procedure, or the data type of arguments passed to a procedure. For code that uses previous versions of the object application, such changes may cause errors. Visual Basic provides a way to define a version of your application as a reference, to which your changes are compared. This reference version is called the "compatible object application." If a change is made that might cause incompatibility with the compatible object application, Visual Basic displays a warning message to alert you to the possible incompatibility. Therefore, to work around the behavior:
Even if you make a compatible change, such as adding a new method, there is no mechanism to tell the running instances of the controllers to use the new version of the interface.
|
Additional reference words: 4.00 vb4win vb4all
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |