Show: Object Pascal C++
Display Preferences

E2160 Type not allowed in OLE Automation call (Object Pascal)

From Appmethod Topics
Jump to: navigation, search

Go Up to Error and Warning Messages (Object Pascal) Index

If a data type cannot be converted by the compiler into a Variant, then it is not allowed in an OLE automation call.


program Produce;

  type
    Base = class
      x : Integer;
    end;

  var
    B : Base;
    V : Variant;

begin
  V.Dispatch(B);
end.

A class cannot be converted into a Variant type, so it is not allowed in an OLE call.


program Solve;


  type
    Base = class
      x : Integer;
    end;

  var
    B : Base;
    V : Variant;

begin
  V.Dispatch(B.i);
end.

The only solution to this problem is to manually convert these data types to Variants or to only use data types that can automatically be converted into a Variant.

Personal tools
In other languages