The information in this article applies to:
SUMMARYVisual Basic 4.0 can do typesafe binding to automation objects. In this scenario, the Visual Basic program will QueryInterface the automation object for its dispatch interface. If the interface is not registered on the machine, the Visual Basic program will fail to create the object. In this case, Visual Basic will report the following error:
MORE INFORMATIONVisual Basic does typesafe binding to an automation object when a variable is dimensioned as a specific type. For instance: When developing this code, establish a reference to the TestVB module (in the Visual Basic development environment, select Tools, References, and Browse for the TestVB type library). Select the type library to register the type library and the dispatch interface for the Document object. The problem occurs when the Visual Basic program and the automation server are loaded on a machine other than the development machine. Even if the automation server is initially run to perform self-registration, the dispatch interface for the automation object will not be registered and the "New" syntax will fail to create the automation object. To eliminate this problem, it is necessary to register the dispatch interface for the automation object on the non-development machine. This can be done programmatically or with a .reg file during setup. In the case of the TestVB module, the Document object's dispatch interface is the ITestVB interface, which is defined as follows in the .cpp file for the Document object:
The following .reg file will register the ITestVB interface and enable
marshaling of the interface via the standard IDispatch proxy and stub.
To programmatically register the interface, #include <winreg.h>, and insert
the following code (with the proper dispatch ID) in the InitInstance of the
automation server:
Additional query words: Automation 430
Keywords : kbole kbMFC kbVC |
Last Reviewed: July 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |