IMcObjectsMcObjectFromHOBJ Method |
![]() |
Namespace: MediaCy.IQL.ObjectManager
Function McObjectFromHOBJ ( HOBJtoLookUp As IntPtr ) As McObject
' See if a McObject still exists Sub SeeIfAoiStillExists() Dim myObj As McObject, myHOBJ As Int_Ptr, myObjAsNumber As Long Set myObj = ThisApplication.McObject(ActiveImage.Aoi) myHOBJ = myObj.InternalHOBJ myObjAsNumber = ObjPtr(myObj) Set myObj = Nothing 'release our reference on the McObject ' See if it is still alive Dim myObj2 As McObject, myObj2AsNumber As Long Set myObj2 = ThisApplication.McObjects.McObjectFromHOBJ(myHOBJ) myObj2AsNumber = ObjPtr(myObj2) Set myObj2 = Nothing 'release our reference on the McObject If myObj2AsNumber = myObjAsNumber Then MsgBox "The original ThisApplication.ActiveImage.Aoi still exists and is alive." Else MsgBox "The original ThisApplication.ActiveImage.Aoi is no longer alive." End If ThisApplication.ActiveWindow.Close 'close the ThisApplication.ActiveImage and test again ' Now see if it is still alive Set myObj2 = ThisApplication.McObjects.McObjectFromHOBJ(myHOBJ) myObj2AsNumber = ObjPtr(myObj2) Set myObj2 = Nothing 'release our reference on the McObject, if any If myObj2AsNumber = myObjAsNumber Then MsgBox "The original ThisApplication.ActiveImage.Aoi still exists and is alive." Else MsgBox "The original ThisApplication.ActiveImage.Aoi is no longer alive." End If End Sub 'SeeIfAoiStillExists