return super(IAccessible,self).parent\r
res=IAccessibleHandler.accParent(self.IAccessibleObject,self.IAccessibleChildID)\r
if res:\r
- return self.correctAPIForRelation(IAccessible(IAccessibleObject=res[0],IAccessibleChildID=res[1]),relation="parent") or super(IAccessible,self).parent\r
+ parentObj=IAccessible(IAccessibleObject=res[0],IAccessibleChildID=res[1])\r
+ if parentObj:\r
+ #Hack around bad MSAA implementations that deliberately skip the window root IAccessible in the ancestry (Skype, iTunes)\r
+ if parentObj.windowHandle!=self.windowHandle and self.IAccessibleRole!=oleacc.ROLE_SYSTEM_WINDOW and winUser.getAncestor(self.windowHandle,winUser.GA_PARENT)==parentObj.windowHandle:\r
+ windowObj=Window(windowHandle=self.windowHandle)\r
+ if windowObj and windowObj.parent==parentObj:\r
+ return windowObj\r
+ return self.correctAPIForRelation(parentObj,relation="parent") or super(IAccessible,self).parent\r
return super(IAccessible,self).parent\r
\r
def _get_next(self):\r