\r
class AppModule(_default.AppModule):\r
def chooseNVDAObjectOverlayClasses(self, obj, clsList):\r
- if obj.windowClassName == VsTextEditPaneClassName:\r
+ # Only use this overlay class if the top level automation object for the IDE can be retrieved,\r
+ # as it will not work otherwise.\r
+ if obj.windowClassName == VsTextEditPaneClassName and self._getDTE():\r
try:\r
clsList.remove(DisplayModelEditableText)\r
except ValueError:\r
elif "!VisualStudio.DTE:%d"%self.processID==displayName:\r
DTEVersion = VsVersion_2002\r
\r
- if DTEVersion > 0:\r
+ if DTEVersion != VsVersion_None:\r
self._DTEVersion = DTEVersion\r
self._DTE = comtypes.client.dynamic.Dispatch(ROT.GetObject(mon).QueryInterface(IDispatch))\r
break\r
- \r
+\r
+ else:\r
+ # None found.\r
+ self._DTE = None\r
+ self._DTEVersion = VsVersion_None\r
+\r
# Loop has completed\r
return self._DTE\r
\r