• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python winUser.getGUIThreadInfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中winUser.getGUIThreadInfo函数的典型用法代码示例。如果您正苦于以下问题:Python getGUIThreadInfo函数的具体用法?Python getGUIThreadInfo怎么用?Python getGUIThreadInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getGUIThreadInfo函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: _get_shouldAllowIAccessibleFocusEvent

 def _get_shouldAllowIAccessibleFocusEvent(self):
     focusWindow = winUser.getGUIThreadInfo(self.windowThreadID).hwndFocus
     if self.windowHandle != focusWindow:
         # This window doesn't have the focus, which means the embedded object's window probably already has the focus.
         # We don't want to override the focus event fired by the embedded object.
         return False
     return super(EmbeddedObject, self).shouldAllowIAccessibleFocusEvent
开发者ID:daisymax,项目名称:nvda,代码行数:7,代码来源:mozilla.py


示例2: _getCaretOffset

 def _getCaretOffset(self):
     caretRect = winUser.getGUIThreadInfo(self.obj.windowThreadID).rcCaret
     objLocation = self.obj.location
     objRect = RECT(objLocation[0], objLocation[1], objLocation[0] + objLocation[2], objLocation[1] + objLocation[3])
     tempPoint = winUser.POINT()
     tempPoint.x = caretRect.left
     tempPoint.y = caretRect.top
     winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
     caretRect.left = max(objRect.left, tempPoint.x)
     caretRect.top = max(objRect.top, tempPoint.y)
     tempPoint.x = caretRect.right
     tempPoint.y = caretRect.bottom
     winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
     caretRect.right = min(objRect.right, tempPoint.x)
     caretRect.bottom = min(objRect.bottom, tempPoint.y)
     for charOffset, (charLeft, charTop, charRight, charBottom, charBaseline) in enumerate(self._textAndRects[1]):
         # Real text with a character baseline
         # The caret must be  anywhere before the horizontal center of the character and the bottom of the caret must touch or go through the character baseline
         if (
             charBaseline >= 0
             and caretRect.left < ((charLeft + charRight) / 2)
             and caretRect.top < charBaseline <= caretRect.bottom
         ):
             return charOffset
     for charOffset, (charLeft, charTop, charRight, charBottom, charBaseline) in enumerate(self._textAndRects[1]):
         # vertical whitespace (possible blank lines)
         # The caret must be fully contained in the whitespace to match
         if (
             charBaseline == -1
             and caretRect.left >= charLeft
             and caretRect.right <= charRight
             and not (caretRect.bottom <= charTop or charBottom <= caretRect.top)
         ):
             return charOffset
     raise RuntimeError
开发者ID:daisymax,项目名称:nvda,代码行数:35,代码来源:displayModel.py


示例3: event_NVDAObject_init

	def event_NVDAObject_init(self,obj):
		if controlTypes.STATE_FOCUSED in obj.states:
			obj.windowHandle=winUser.getGUIThreadInfo(None).hwndFocus
			obj.windowClassName=winUser.getClassName(obj.windowHandle)
		if obj.value and obj.windowClassName in ["TMainUserList", "TConversationList", "TInboxList", "TActiveConversationList", "TConversationsControl"] and not obj.role in [controlTypes.ROLE_MENUBAR, controlTypes.ROLE_MENUITEM, controlTypes.ROLE_POPUPMENU]:
			obj.name=obj.value
			obj.value=None
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:7,代码来源:skype.py


示例4: _get_SDMChild

	def _get_SDMChild(self):
		if controlTypes.STATE_FOCUSED in self.states:
			hwndFocus=winUser.getGUIThreadInfo(0).hwndFocus
			if hwndFocus and hwndFocus!=self.windowHandle and not winUser.getClassName(hwndFocus).startswith('bosa_sdm'):
				obj=getNVDAObjectFromEvent(hwndFocus,winUser.OBJID_CLIENT,0)
				if not obj: return None
				if getattr(obj,'parentSDMCanOverrideName',True):
					obj.name=self.name
				return obj
		return None
开发者ID:KarishmaChanglani,项目名称:nvda,代码行数:10,代码来源:msOffice.py


示例5: WindowSelectionChange

	def WindowSelectionChange(self,sel):
		i=winUser.getGUIThreadInfo(0)
		oldFocus=api.getFocusObject()
		if not isinstance(oldFocus,Window) or i.hwndFocus!=oldFocus.windowHandle:
			return
		if isinstance(oldFocus,DocumentWindow):
			documentWindow=oldFocus
		elif isinstance(oldFocus,PpObject):
			documentWindow=oldFocus.documentWindow
		else:
			return
		documentWindow.ppSelection=sel
		documentWindow.handleSelectionChange()
开发者ID:BabbageCom,项目名称:nvda,代码行数:13,代码来源:powerpnt.py


示例6: shouldConfigProfileTriggersBeSuspended

def shouldConfigProfileTriggersBeSuspended():
	"""Determine whether configuration profile triggers should be suspended in relation to NVDA's GUI.
	For NVDA configuration dialogs, the configuration should remain the same as it was before the GUI was popped up
	so the user can change settings in the correct profile.
	Top-level windows that require this behavior should have a C{shouldSuspendConfigProfileTriggers} attribute set to C{True}.
	Because these dialogs are often opened via the NVDA menu, this applies to the NVDA menu as well.
	"""
	if winUser.getGUIThreadInfo(ctypes.windll.kernel32.GetCurrentThreadId()).flags & 0x00000010:
		# The NVDA menu is active.
		return True
	for window in wx.GetTopLevelWindows():
		if window.IsShown() and getattr(window, "shouldSuspendConfigProfileTriggers", False):
			return True
	return False
开发者ID:timothytylee,项目名称:nvda,代码行数:14,代码来源:__init__.py


示例7: event_NVDAObject_init

	def event_NVDAObject_init(self,obj):
		if isinstance(obj, NVDAObjects.IAccessible.IAccessible) and obj.event_objectID is None and controlTypes.STATE_FOCUSED in obj.states and obj.role not in (controlTypes.ROLE_POPUPMENU,controlTypes.ROLE_MENUITEM,controlTypes.ROLE_MENUBAR):
			# The window handle reported by Skype accessibles is sometimes incorrect.
			# This object is focused, so we can override with the focus window.
			obj.windowHandle=winUser.getGUIThreadInfo(None).hwndFocus
			obj.windowClassName=winUser.getClassName(obj.windowHandle)
		if obj.value and obj.windowClassName in ("TMainUserList", "TConversationList", "TInboxList", "TActiveConversationList", "TConversationsControl"):
			# The name and value both include the user's name, so kill the value to avoid doubling up.
			# The value includes the Skype name,
			# but we care more about the additional info (e.g. new event count) included in the name.
			obj.value=None
		elif isinstance(obj, NVDAObjects.IAccessible.IAccessible) and obj.IAccessibleRole == oleacc.ROLE_SYSTEM_PANE and not obj.name:
			# Prevent extraneous reporting of pane when tabbing through a conversation form.
			obj.shouldAllowIAccessibleFocusEvent = False
开发者ID:ehollig,项目名称:nvda,代码行数:14,代码来源:skype.py


示例8: kwargsFromSuper

	def kwargsFromSuper(cls,kwargs,relation=None):
		windowHandle=None
		if relation in ('focus','foreground'):
			windowHandle=winUser.getForegroundWindow()
			if not windowHandle: windowHandle=winUser.getDesktopWindow()
			if windowHandle and relation=="focus":
				threadID=winUser.getWindowThreadProcessID(windowHandle)[1]
				threadInfo=winUser.getGUIThreadInfo(threadID)
				if threadInfo.hwndFocus: windowHandle=threadInfo.hwndFocus
		elif isinstance(relation,tuple):
			windowHandle=_windowFromPoint(ctypes.wintypes.POINT(relation[0],relation[1]))
		if not windowHandle:
			return False
		kwargs['windowHandle']=windowHandle
		return True
开发者ID:josephsl,项目名称:nvda4nvda,代码行数:15,代码来源:__init__.py


示例9: _shouldRecoverAfterMinTimeout

def _shouldRecoverAfterMinTimeout():
	info=winUser.getGUIThreadInfo(0)
	#If hwndFocus is 0, then the OS is clearly busy and we don't want to timeout prematurely.
	if not info.hwndFocus: return False
	# Import late to avoid circular import.
	import api
	#If a system menu has been activated but NVDA's focus is not yet in the menu then use min timeout
	if info.flags&winUser.GUI_SYSTEMMENUMODE and info.hwndMenuOwner and api.getFocusObject().windowClassName!='#32768':
		return True 
	if winUser.getClassName(info.hwndFocus) in safeWindowClassSet:
		return False
	if not winUser.isDescendantWindow(info.hwndActive, api.getFocusObject().windowHandle):
		# The foreground window has changed.
		return True
	newHwnd=info.hwndFocus
	newThreadID=winUser.getWindowThreadProcessID(newHwnd)[1]
	return newThreadID!=api.getFocusObject().windowThreadID
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:17,代码来源:watchdog.py


示例10: _shouldRecoverAfterMinTimeout

def _shouldRecoverAfterMinTimeout():
	info=winUser.getGUIThreadInfo(0)
	if not info.hwndFocus:
		# The foreground thread is frozen or there is no foreground thread (probably due to a freeze elsewhere).
		return True
	# Import late to avoid circular import.
	import api
	#If a system menu has been activated but NVDA's focus is not yet in the menu then use min timeout
	if info.flags&winUser.GUI_SYSTEMMENUMODE and info.hwndMenuOwner and api.getFocusObject().windowClassName!='#32768':
		return True 
	if winUser.getClassName(info.hwndFocus) in safeWindowClassSet:
		return False
	if not winUser.isDescendantWindow(info.hwndActive, api.getFocusObject().windowHandle):
		# The foreground window has changed.
		return True
	newHwnd=info.hwndFocus
	newThreadID=winUser.getWindowThreadProcessID(newHwnd)[1]
	return newThreadID!=api.getFocusObject().windowThreadID
开发者ID:lpintes,项目名称:NVDA,代码行数:18,代码来源:watchdog.py


示例11: _getCaretOffset

	def _getCaretOffset(self):
		caretRect = winUser.getGUIThreadInfo(self.obj.windowThreadID).rcCaret
		objLocation=self.obj.location
		objRect=RECT(objLocation[0],objLocation[1],objLocation[0]+objLocation[2],objLocation[1]+objLocation[3])
		tempPoint = winUser.POINT()
		tempPoint.x=caretRect.left
		tempPoint.y=caretRect.top
		winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
		caretRect.left=max(objRect.left,tempPoint.x)
		caretRect.top=max(objRect.top,tempPoint.y)
		tempPoint.x=caretRect.right
		tempPoint.y=caretRect.bottom
		winUser.user32.ClientToScreen(self.obj.windowHandle, byref(tempPoint))
		caretRect.right=min(objRect.right,tempPoint.x)
		caretRect.bottom=min(objRect.bottom,tempPoint.y)
		import speech
		for charOffset, (charLeft, charTop, charRight, charBottom) in enumerate(self._textAndRects[1]):
			#speech.speakMessage("caret %d,%d char %d,%d"%(caretRect.top,caretRect.bottom,charTop,charBottom))
			if caretRect.left>=charLeft and caretRect.right<=charRight and ((caretRect.top<=charTop and caretRect.bottom>=charBottom) or (caretRect.top>=charTop and caretRect.bottom<=charBottom)):
				return charOffset
		raise RuntimeError
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:21,代码来源:displayModel.py


示例12: findOverlayClasses

	def findOverlayClasses(self,clsList):
		windowClassName=self.normalizeWindowClassName(self.windowClassName)
		newCls=None
		if windowClassName=="#32769":
			newCls=Desktop
		elif windowClassName=="Edit":
			from .edit import Edit as newCls
		elif windowClassName=="RichEdit":
			from .edit import RichEdit as newCls
		elif windowClassName in ("RichEdit20","REComboBox20W"):
			from .edit import RichEdit20 as newCls
		elif windowClassName=="RICHEDIT50W":
			from .edit import RichEdit50 as newCls
		elif windowClassName in ("Scintilla","TScintilla"):
			from .scintilla import Scintilla as newCls
		elif windowClassName in ("AkelEditW", "AkelEditA"):
			from .akelEdit import AkelEdit as newCls
		elif windowClassName=="ConsoleWindowClass":
			from .winConsole import WinConsole as newCls
		elif windowClassName=="EXCEL7":
			from .excel import Excel7Window as newCls
		if newCls:
			clsList.append(newCls)

		# If none of the chosen classes seem to support text editing
		# but there is a caret currently in the window,
		# check whether this window exposes its content without using the display model.
		# If not, use the displayModelEditableText class to emulate text editing capabilities
		if not any(issubclass(cls,EditableText) for cls in clsList):
			gi=winUser.getGUIThreadInfo(self.windowThreadID)
			if gi.hwndCaret==self.windowHandle and gi.flags&winUser.GUI_CARETBLINKING:
				if self.windowTextLineCount:
					from .edit import UnidentifiedEdit
					clsList.append(UnidentifiedEdit)
				else:
					clsList.append(DisplayModelEditableText)

		clsList.append(Window)
		super(Window,self).findOverlayClasses(clsList)
开发者ID:josephsl,项目名称:nvda4nvda,代码行数:39,代码来源:__init__.py


示例13: findOverlayClasses

	def findOverlayClasses(self,clsList):
		windowClassName=self.normalizeWindowClassName(self.windowClassName)
		newCls=None
		if windowClassName=="#32769":
			newCls=Desktop
		elif windowClassName=="Edit":
			from .edit import Edit as newCls
		elif windowClassName=="RichEdit":
			from .edit import RichEdit as newCls
		elif windowClassName in ("RichEdit20","REComboBox20W"):
			from .edit import RichEdit20 as newCls
		elif windowClassName=="RICHEDIT50W":
			from .edit import RichEdit50 as newCls
		elif windowClassName in ("Scintilla","TScintilla"):
			from .scintilla import Scintilla as newCls
		elif windowClassName in ("AkelEditW", "AkelEditA"):
			from .akelEdit import AkelEdit as newCls
		elif windowClassName=="ConsoleWindowClass":
			from .winConsole import WinConsole as newCls
		elif windowClassName=="_WwG":
			from .winword import WordDocument as newCls
		elif windowClassName in ("_WwN","_WwO"):
			from .winword import WordDocument_WwN as newCls
		elif windowClassName=="EXCEL7":
			from .excel import Excel7Window as newCls
		if newCls:
			clsList.append(newCls)

		#If none of the chosen classes seem to support text editing
		#But there is a caret currently in the window
		#Then use the displayModelEditableText class to emulate text editing capabilities
		if not any(issubclass(cls,EditableText) for cls in clsList):
			gi=winUser.getGUIThreadInfo(self.windowThreadID)
			if gi.hwndCaret==self.windowHandle and gi.flags&winUser.GUI_CARETBLINKING:
				clsList.append(DisplayModelEditableText)

		clsList.append(Window)
		super(Window,self).findOverlayClasses(clsList)
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:38,代码来源:__init__.py


示例14: _get_shouldAllowIAccessibleFocusEvent

	def _get_shouldAllowIAccessibleFocusEvent(self):
		# The window must really have focus.
		# Outlook can sometimes fire invalid focus events when showing daily tasks within the calendar.
		if winUser.getGUIThreadInfo(self.windowThreadID).hwndFocus!=self.windowHandle:
			return False
		return super(SuperGridClient2010,self).shouldAllowIAccessibleFocusEvent
开发者ID:eklipse2009,项目名称:nvda,代码行数:6,代码来源:outlook.py


示例15: SlideShowNextSlide

	def SlideShowNextSlide(self,slideShowWindow=None):
		i=winUser.getGUIThreadInfo(0)
		oldFocus=api.getFocusObject()
		if not isinstance(oldFocus,SlideShowWindow) or i.hwndFocus!=oldFocus.windowHandle:
			return
		oldFocus.treeInterceptor.rootNVDAObject.handleSlideChange()
开发者ID:BabbageCom,项目名称:nvda,代码行数:6,代码来源:powerpnt.py


示例16: _get_shouldAllowIAccessibleFocusEvent

 def _get_shouldAllowIAccessibleFocusEvent(self):
     # #4199: Some SDM controls can incorrectly firefocus when they are not focused
     # E.g. File recovery pane, clipboard manager pane
     if winUser.getGUIThreadInfo(0).hwndFocus != self.windowHandle:
         return False
     return super(SDM, self).shouldAllowIAccessibleFocusEvent
开发者ID:RKelson93,项目名称:nvda,代码行数:6,代码来源:msOffice.py


示例17: shouldAcceptEvent

def shouldAcceptEvent(eventName, windowHandle=None):
	"""Check whether an event should be accepted from a platform API.
	Creating NVDAObjects and executing events can be expensive
	and might block the main thread noticeably if the object is slow to respond.
	Therefore, this should be used before NVDAObject creation to filter out any unnecessary events.
	A platform API handler may do its own filtering before this.
	"""
	if not windowHandle:
		# We can't filter without a window handle.
		return True
	wClass = winUser.getClassName(windowHandle)
	key = (eventName,
		winUser.getWindowThreadProcessID(windowHandle)[0],
		wClass)
	if key in _acceptEvents:
		return True
	if eventName == "valueChange" and config.conf["presentation"]["progressBarUpdates"]["reportBackgroundProgressBars"]:
		return True
	if eventName == "show":
		# Only accept 'show' events for specific cases, as otherwise we get flooded.
		return wClass in (
			"Frame Notification Bar", # notification bars
			"tooltips_class32", # tooltips
			"mscandui21.candidate", "mscandui40.candidate", "MSCandUIWindow_Candidate", # IMM candidates
			"TTrayAlert", # 5405: Skype
		)
	if eventName == "reorder":
		# Prevent another flood risk.
		return wClass == "TTrayAlert" # #4841: Skype
	if eventName == "alert" and winUser.getClassName(winUser.getAncestor(windowHandle, winUser.GA_PARENT)) == "ToastChildWindowClass":
		# Toast notifications.
		return True
	if eventName in ("menuEnd", "switchEnd", "desktopSwitch"):
		# #5302, #5462: These events can be fired on the desktop window
		# or windows that would otherwise be blocked.
		# Platform API handlers will translate these events to focus events anyway,
		# so we must allow them here.
		return True
	if windowHandle == winUser.getDesktopWindow():
		# #5595: Events for the cursor get mapped to the desktop window.
		return True

	# #6713: Edge (and soon all UWP apps) will no longer have windows as descendants of the foreground window.
	# However, it does look like they are always  equal to or descendants of the "active" window of the input thread. 
	if wClass.startswith('Windows.UI.Core'):
		gi=winUser.getGUIThreadInfo(0)
		if winUser.isDescendantWindow(gi.hwndActive,windowHandle):
			return True

	fg = winUser.getForegroundWindow()
	if wClass == "NetUIHWND" and winUser.getClassName(fg) == "Net UI Tool Window Layered":
		# #5504: In Office >= 2013 with the ribbon showing only tabs,
		# when a tab is expanded, the window we get from the focus object is incorrect.
		# This window isn't beneath the foreground window,
		# so our foreground application checks fail.
		# Just compare the root owners.
		if winUser.getAncestor(windowHandle, winUser.GA_ROOTOWNER) == winUser.getAncestor(fg, winUser.GA_ROOTOWNER):
			return True
	if (winUser.isDescendantWindow(fg, windowHandle)
			# #3899, #3905: Covers cases such as the Firefox Page Bookmarked window and OpenOffice/LibreOffice context menus.
			or winUser.isDescendantWindow(fg, winUser.getAncestor(windowHandle, winUser.GA_ROOTOWNER))):
		# This is for the foreground application.
		return True
	if (winUser.user32.GetWindowLongW(windowHandle, winUser.GWL_EXSTYLE) & winUser.WS_EX_TOPMOST
			or winUser.user32.GetWindowLongW(winUser.getAncestor(windowHandle, winUser.GA_ROOT), winUser.GWL_EXSTYLE) & winUser.WS_EX_TOPMOST):
		# This window or its root is a topmost window.
		# This includes menus, combo box pop-ups and the task switching list.
		return True
	return False
开发者ID:JRMeyer,项目名称:nvda,代码行数:69,代码来源:eventHandler.py



注:本文中的winUser.getGUIThreadInfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python winUser.getWindowThreadProcessID函数代码示例发布时间:2022-05-26
下一篇:
Python winUser.getForegroundWindow函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap