Article ID: 258192 - Last Review: May 13, 2003 - Revision: 2.0 PRB: Error Messages When Recompiling ActiveX Component with Binary CompatibilityThis article was previously published under Q258192 SYMPTOMS
A run-time error is raised when an ActiveX component is recompiling in Visual Basic, as follows. When recompiling a Visual Basic ActiveX EXE or ActiveX DLL, the client application may display the following error message:
Run-Time Error '430': Class Does not support Automation or does not support expected interface
Failed to activate control 'VB.UserControl'. This control may be incompatible with your application. Make sure that you are using the version of the control that was provided with your application.
CAUSE
These errors occur if Public Methods or Properties are added to the ActiveX component after making a copy for Binary Compatibility and then recompiling the component a second time. When new Public Methods or Properties are added to an ActiveX .exe, ActiveX .dll, or a UserControl with Binary Compatibility set, Visual Basic adds a new Interface to the second version for new client applications to use, and creates a pointer from the old interface to the new Interface so that old clients continue to work. However, a problem occurs when a third version of this new ActiveX component is compiled without resetting the Binary Compatible file to the second version of the ActiveX .exe, .dll, or .ocx file. When this occurs, a new universally unique identifier (UUID) and Interface are generated and any client applications compiled against the second version fail. RESOLUTION
Ensure that the Binary Compatibility is always set to the latest version of your ActiveX component, or a version that includes all Public Methods and Properties.
STATUS
This behavior is by design.
MORE INFORMATION
The following discussion uses an ActiveX .exe file as an example, but it should be noted that the behavior for Interfaces is the same for all three types of ActiveX components. When you first compile an ActiveX .exe, ActiveX .dll, or UserControl (for example, Server1.exe), Visual Basic creates an Interface for the Public Methods and Properties, as follows: Collapse this table
If a new Method is added to the existing ActiveX .exe and Binary Compatibility is set to Server1.exe, when the modified .exe is recompiled to Server2.exe, the Interface structure is as follows: Collapse this table
Calls on Interface1 are redirected to the correct Method or Property on Interface2 for old clients. New clients automatically use Interface2. This mechanism is transparent to the user and needs no special coding on the client or the server. If the .exe is compiled again without changing the file reference for binary compatibility, (call it Server3.exe) then the following table is generated: Collapse this table
Interface2 and Interface3 now have the same Methods but they are not the same interface because they do not have the same UUID. This means that Server2.exe and Server3.exe cannot be used interchangeably because they are not compatible with each other. They are, however, both compatible with Server1.exe and can be used with applications that are already compiled to use Server1.exe. REFERENCES161137
(http://support.microsoft.com/kb/161137/EN-US/
)
HOWTO: Use Project and Binary Compatibility
| Article Translations
|
Back to the top
