ID: Q122287
2.02 3.00 WINDOWS kbole kbprg
The information in this article applies to:
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:
Visual 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:
-or-
Here are two known third-party controllers:
NOTE: The products included here are manufactured by vendors independent of Microsoft; we make no warranty, implied or otherwise, regarding these products' performance or reliability.
Softbridge Basic Language Mystic River Software, Inc. 125 CambridgePark Drive, Cambridge MA 02140 Tel:1-800-298-3500, 617-497-1585 Fax:617-864-7747
Summit BasicScript Summit Software Company, 2844 Sweet Road, Jamesville, NY 13078 Tel: 315-677-9000 Fax: 315-677-3224 Internet: info@summsoft.com
-or-
The DLL functions can pass parameters by reference to the properties and methods of the automation method or property because OLE supports passing parameters by reference. This approach may not be suitable for some automation servers that implement nested objects.
Array 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.
Value = ObjVar.Selection(I)
ObjVar.Selection(I) = Value
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:
[propget] VARIANT Value(long index);
[propput] void Value(long index, VARIANT NewValue);
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).
When 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.
Additional reference words: 2.00 3.00 5.00 KBCategory: kbole kbprg KBSubcategory: LeTwoAto
Keywords : kb3rdparty LeTwoAto
Version : 2.02 3.00
Platform : WINDOWS
Last Reviewed: May 13, 1998