Article ID: 122287 - View products that this article applies to.
This article was previously published under Q122287
This article has been archived. It is offered "as is" and will no longer be updated.
Visual Basic version 3.0 for Windows and Disptest (the automation controller that shipped with OLE version 2.0) have the following limitations as automation controllers in addition to those described on pages 67-69 of the OLE 2 Programmer's Reference, Volume 2:
Parameters Cannot Be Passed by ReferenceVisual Basic version 3.0 for Windows and Disptest cannot pass parameters by reference to automation properties and methods.
This is a limitation of Visual Basic version 3.0 and Disptest, not of OLE Automation. OLE Automation allows building controllers that pass parameters by reference.
Here are three workarounds:
Array Elements Cannot Be AccessedArray elements cannot be accessed in Visual Basic version 3.0 or Disptest. As a result, code similar to the following code cannot be executed in Visual Basic version 3.0 or in Disptest if selection returns a safearray. This is because safearray elements cannot be accessed in Visual Basic version 3.0 or in Disptest.
Workarounds include using indexed properties, third-party controllers, Visual Basic for Applications in Microsoft Excel version 5.0, or waiting for a future release of Visual Basic.
Indexed properties are properties that take parameters. For example, in the example code, Selection could be made a property that takes an index parameter. Here is a description in the .ODL file of an indexed parameter called Value whose property type is VARIANT:
In a dispinterface, an indexed property should be used under the 'methods' keyword. A Microsoft Foundations Classes (MFC) implementation can use the DISP_PROPERTY_PARAM macro in the dispatch map to implement an indexed property.
The disadvantage of implementing array element access using indexed properties is the performance penalty caused by each indexed property access requiring the overhead of an RPC/LRPC call (for LocalServer Automation objects).
Value of EXCEPINFO.wCode Not Displayed on ExceptionsWhen an automation object raises an exception by returning DISP_E_EXCEPTION from IDispatch::Invoke and by filling the pexcepinfo parameter of this method, Visual Basic version 3.0 and Disptest will ignore the value returned in the wCode field of the EXCEPINFO structure, instead returning the value 440. Note that either the wCode or scode field of EXCEPINFO should be set to 0 -- both cannot be used.
Workarounds include using third-party controllers, Visual Basic for Applications in Microsoft Excel version 5.0, or waiting for a future release of Visual Basic.