* Create two forms o1 = createobject("Form") o2 = createobject("Form") ?compobj(o1,o2) && Returns .f. - No surprise since && their captions and names are different ?compobj(o1,o1) && Returns .t. - Again no surprise *make another reference to o1 o3 = o1 ?compobj(o1,o3) && Returns .t. - Good *Now watch this o2.Caption = o1.Caption o2.Name = o1.Name ?compobj(o1,o2) && Surprise - Returns .t. * So how do we find out if they point to the same object * Thanks to Ken Levy for the basic idea here: cHoldCaption = o1.caption o1.caption = "XXX" ?compobj(o1,o3) && Still returns .t. - they're the same ?compobj(o1,o2) && Returns .f. - they're different o1.caption = cHoldCaptionSo extended implementation :
if lExactlySame(thisform.surrounded,this) .. endif function lExactlySame lparameters o1, o2 cHoldName = o1.name o1.name = "xxx" rVal = compobj(o1,o2) o1.name = cHoldName return rValCetin