EqualUnoObjects Function

Returns True if the two specified Basic variables represent the same Uno object instance.

语法:

EqualUnoObjects(oObj1, oObj2)

参数:

oObj1, oObj2: the variables to be tested.

返回值:

布尔

示例:

The example below returns True because both oDoc and ThisComponent are references to the same object:


    Dim oDoc as Object
    oDoc = ThisComponent
    MsgBox EqualUnoObjects(oDoc, ThisComponent) ' True
  

The example below returns False because the assignment creates a copy of the original object. Hence Struct1 and Struct2 refer to different object instances.


    Dim Struct1 as new com.sun.star.beans.PropertyValue
    Dim Struct2 as Variant
    Struct1.Name = "John"
    Struct2 = Struct1
    MsgBox EqualUnoObjects(Struct1, Struct2) ' False
    Struct2.Name = "Judy"
    MsgBox Struct1.Name ' John
    MsgBox Struct2.Name ' Judy
  

请支持我们!