コード例 #1
0
	def _get_WinwordWindowObject(self):
		if not getattr(self,'_WinwordWindowObject',None): 
			try:
				pDispatch=oleacc.AccessibleObjectFromWindow(self.windowHandle,winUser.OBJID_NATIVEOM,interface=comtypes.automation.IDispatch)
			except (COMError, WindowsError):
				log.debugWarning("Could not get MS Word object model",exc_info=True)
				return None
			self._WinwordWindowObject=comtypes.client.dynamic.Dispatch(pDispatch)
		return self._WinwordWindowObject
コード例 #2
0
ファイル: excel.py プロジェクト: mai-codes/evoHax-nvda
 def excelWindowObjectFromWindow(windowHandle):
     try:
         pDispatch = oleacc.AccessibleObjectFromWindow(
             windowHandle,
             winUser.OBJID_NATIVEOM,
             interface=comtypes.automation.IDispatch)
     except (COMError, WindowsError):
         return None
     return comtypes.client.dynamic.Dispatch(pDispatch)
コード例 #3
0
ファイル: powerpnt.py プロジェクト: mai-codes/evoHax-nvda
def getPpObjectModel(windowHandle):
	"""
	Fetches the Powerpoint object model from a given PaneClassDC window.
	"""
	try:
		pDispatch=oleacc.AccessibleObjectFromWindow(windowHandle,winUser.OBJID_NATIVEOM,interface=comtypes.automation.IDispatch)
	except (comtypes.COMError, WindowsError):
		log.debugWarning("Could not get MS Powerpoint object model",exc_info=True)
		return None
	return comtypes.client.dynamic.Dispatch(pDispatch)
コード例 #4
0
def closeAllWindows(windowsList):
		for f in windowsList:
			if f[0] == api.getDesktopObject().name:
				# it is desktop window, destroy is not possible
				continue
			# window handle to destroy
			hwnd = f[1]
			obj = NVDAObjects.window.Window(windowHandle=hwnd)
			if obj.appModule.appName == "nvda":
				# we cannot destroy nvda windows
				continue
			# we destroy it
			oleacc.AccessibleObjectFromWindow(hwnd, -2).accDoDefaultAction(5)
コード例 #5
0
	def onDestroyButton(self, evt):
		index = self.windowsListBox.GetSelection()
		# we memorize windows count
		oldWindowsCount = self.windowsListBox.GetCount()
		if self.activeWindows[index][0] == api.getDesktopObject().name:
			# it is desktop window, destroy is not possible
			# Translators: a message announced in active windows list display dialog.
			msg = _("Impossible to destroy desktop window")
			queueHandler.queueFunction(
				queueHandler.eventQueue, ui.message, msg)
			self.windowsListBox.SetSelection(index)
			if not self.windowsListBox.HasFocus():
				self.windowsListBox.SetFocus()
			return
		# window handle to destroy
		hwnd = self.activeWindows[index][1]
		obj = NVDAObjects.window.Window(windowHandle=hwnd)
		if obj.appModule.appName == "nvda":
			# we cannot destroy nvda windows
			# Translators: message to user to announce the window cannot be destroyed.
			msg = _("Impossible to destroy the window")
			queueHandler.queueFunction(
				queueHandler.eventQueue, ui.message, msg)
			self.windowsListBox.SetFocus()
			return
		# we destroy it
		oleacc.AccessibleObjectFromWindow(hwnd, -2).accDoDefaultAction(5)
		time.sleep(0.5)
		# windows list update
		self.windowsListInit()
		self.windowsListBox.Clear()
		time.sleep(0.1)
		self.windowsListBox.AppendItems(self.windowNamesList)
		# check if window is really destroyed
		newWindowsCount = self.windowsListBox.GetCount()
		if oldWindowsCount == newWindowsCount:
			# Translators: message to user to announce the window cannot be destroyed.
			msg = _("Impossible to destroy the window")
			queueHandler.queueFunction(
				queueHandler.eventQueue, ui.message, msg)
			self.windowsListBox.SetSelection(index)
			if not self.windowsListBox.HasFocus():
				self.windowsListBox.SetFocus()
			return
		# we must select the next window
		if newWindowsCount > index + 1:
			self.windowsListBox.SetSelection(index)
		else:
			self.windowsListBox.SetSelection(newWindowsCount-1)
		# focus on windows list
		self.windowsListBox.SetFocus()
コード例 #6
0
ファイル: winword.py プロジェクト: mai-codes/evoHax-nvda
 def _get_WinwordWindowObject(self):
     hwnd = NVDAHelper.localLib.findWindowWithClassInThread(
         self.windowThreadID, u"_WwG", True)
     if hwnd:
         try:
             window = comtypes.client.dynamic.Dispatch(
                 oleacc.AccessibleObjectFromWindow(
                     hwnd,
                     winUser.OBJID_NATIVEOM,
                     interface=comtypes.automation.IDispatch))
         except (COMError, WindowsError):
             log.debugWarning("Could not get MS Word object model",
                              exc_info=True)
             return None
         try:
             return window.application.activeWindow.activePane
         except COMError:
             log.debugWarning(
                 "can't use activeWindow, resorting to windows[1]",
                 exc_info=True)
             return window.application.windows[1].activePane