当前位置: 首页>>代码示例>>Python>>正文


Python win32gui.GetWindowText方法代码示例

本文整理汇总了Python中win32gui.GetWindowText方法的典型用法代码示例。如果您正苦于以下问题:Python win32gui.GetWindowText方法的具体用法?Python win32gui.GetWindowText怎么用?Python win32gui.GetWindowText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在win32gui的用法示例。


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

示例1: dumpWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def dumpWindow(hwnd, wantedText=None, wantedClass=None):
    '''
    :param hwnd: 窗口句柄
    :param wantedText: 指定子窗口名
    :param wantedClass: 指定子窗口类名
    :return: 返回父窗口下所有子窗体的句柄
    '''
    windows = []
    hwndChild = None
    while True:
        hwndChild = win32gui.FindWindowEx(hwnd, hwndChild, wantedClass, wantedText)
        if hwndChild:
            textName = win32gui.GetWindowText(hwndChild)
            className = win32gui.GetClassName(hwndChild)
            windows.append((hwndChild, textName, className))
        else:
            return windows 
开发者ID:ynzheng,项目名称:pyautotrade_tdx,代码行数:19,代码来源:winguiauto.py

示例2: init

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def init(debug :bool =False) -> Dict[int, Tuple[int, int, int, int]]:
        """Finds the game window and returns its coords."""
        if platform.release() == "10":
            ctypes.windll.shcore.SetProcessDpiAwareness(2)
        else:
            ctypes.windll.user32.SetProcessDPIAware()

        def window_enumeration_handler(hwnd, top_windows):
            """Add window title and ID to array."""
            top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))

        if debug:
            window_name = "debugg"
        else:
            window_name = "play ngu idle"

        top_windows = []
        windows = []
        candidates = {}
        win32gui.EnumWindows(window_enumeration_handler, top_windows)
        windows = [window[0] for window in top_windows if window_name in window[1].lower()]
        for window in windows:
            candidates[window] = Window.winRect(window)
        return candidates 
开发者ID:kujan,项目名称:NGU-scripts,代码行数:26,代码来源:window.py

示例3: enumCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def enumCallback(hwnd, self):
            title = win32gui.GetWindowText(hwnd)

            for name in self.WindowNames:
                if title.find(name) > -1:
                    try:
                        self.FoundWindowEvent.set()

                        if self.CloseWindows:
                            win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
                    except:
                        pass
                else:
                    try:
                        win32gui.EnumChildWindows(hwnd, _WindowWatcher.enumChildCallback, self)
                    except:
                        pass

            return True 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:21,代码来源:gui.py

示例4: enumCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def enumCallback(hwnd, args):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            proc = args[0]
            windowName = args[1]

            try:
                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    win32gui.EnumChildWindows(hwnd, FileWriterLauncherGui.enumChildCallback, args)
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
            except:
                pass 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:24,代码来源:file.py

示例5: enumChildCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def enumChildCallback(hwnd, args):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            proc = args[0]
            windowName = args[1]

            try:

                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)

            except:
                pass
            #print sys.exc_info() 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:26,代码来源:file.py

示例6: enumCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def enumCallback(hwnd, windowName):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            try:
                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    win32gui.EnumChildWindows(hwnd, FileWriterLauncherGui.enumChildCallback, windowName)
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
            except:
                pass 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:21,代码来源:process.py

示例7: enumChildCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def enumChildCallback(hwnd, windowName):
            """
            Will get called by win32gui.EnumWindows, once for each
            top level application window.
            """

            try:

                # Get window title
                title = win32gui.GetWindowText(hwnd)

                # Is this our guy?
                if title.find(windowName) == -1:
                    return

                # Send WM_CLOSE message
                win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)

            except:
                pass
            #print sys.exc_info() 
开发者ID:MozillaSecurity,项目名称:peach,代码行数:23,代码来源:process.py

示例8: dumpSpecifiedWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def dumpSpecifiedWindow(hwnd, wantedText=None, wantedClass=None):
    '''
    :param hwnd: 父窗口句柄
    :param wantedText: 指定子窗口名
    :param wantedClass: 指定子窗口类名
    :return: 返回父窗口下所有子窗体的句柄
    '''
    windows = []
    hwndChild = None
    while True:
        hwndChild = win32gui.FindWindowEx(hwnd, hwndChild, wantedClass, wantedText)
        if hwndChild:
            textName = win32gui.GetWindowText(hwndChild)
            className = win32gui.GetClassName(hwndChild)
            windows.append((hwndChild, textName, className))
        else:
            return windows 
开发者ID:wangdkchina,项目名称:pyautotrade_tdx,代码行数:19,代码来源:winguiauto.py

示例9: dumpWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def dumpWindow(hwnd, wantedText=None, wantedClass=None):
    """
    :param hwnd: 窗口句柄
    :param wantedText: 指定子窗口名
    :param wantedClass: 指定子窗口类名
    :return: 返回父窗口下所有子窗体的句柄
    """
    windows = []
    hwndChild = None
    while True:
        hwndChild = win32gui.FindWindowEx(hwnd, hwndChild, wantedClass, wantedText)
        if hwndChild:
            textName = win32gui.GetWindowText(hwndChild)
            className = win32gui.GetClassName(hwndChild)
            windows.append((hwndChild, textName, className))
        else:
            return windows 
开发者ID:drongh,项目名称:pyAutoTrading,代码行数:19,代码来源:winguiauto.py

示例10: __call__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def __call__(self):
        if self.plugin.runFlg and self.plugin.mpcHwnd:
            try:
                child = GetDlgItem(self.plugin.mpcHwnd, 10021)
                if GetClassName(child) ==  "#32770":
                    statText = GetDlgItem(child, 12027)
                    if GetClassName(statText) ==  "Static":
                        elaps, total = GetWindowText(statText).split(" / ")
                        elaps = GetSec(elaps)
                        totSec = GetSec(total)
                        rem = strftime('%H:%M:%S', gmtime(totSec-elaps))
                        elaps = strftime('%H:%M:%S', gmtime(elaps))
                        total = strftime('%H:%M:%S', gmtime(totSec))
            except:
                return None, None, None
            return elaps, rem, total
        else:
            eg.programCounter = None
            raise self.Exceptions.ProgramNotRunning
#=============================================================================== 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:22,代码来源:__init__.py

示例11: on_press

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def on_press(key):
	global old_app

	new_app = win32gui.GetWindowText(win32gui.GetForegroundWindow())

	if new_app == 'Cortana':
		new_app = 'Windows Start Menu'
	else:
		pass
	
	
	if new_app != old_app and new_app != '':
		logged_data.append(f'[{datetime}] ~ {new_app}\n')
		old_app = new_app
	else:
		pass


	substitution = ['Key.enter', '[ENTER]\n', 'Key.backspace', '[BACKSPACE]', 'Key.space', ' ',
	'Key.alt_l', '[ALT]', 'Key.tab', '[TAB]', 'Key.delete', '[DEL]', 'Key.ctrl_l', '[CTRL]', 
	'Key.left', '[LEFT ARROW]', 'Key.right', '[RIGHT ARROW]', 'Key.shift', '[SHIFT]', '\\x13', 
	'[CTRL-S]', '\\x17', '[CTRL-W]', 'Key.caps_lock', '[CAPS LK]', '\\x01', '[CTRL-A]', 'Key.cmd', 
	'[WINDOWS KEY]', 'Key.print_screen', '[PRNT SCR]', '\\x03', '[CTRL-C]', '\\x16', '[CTRL-V]']

	key = str(key).strip('\'')
	if key in substitution:
		logged_data.append(substitution[substitution.index(key)+1])
	else:
		logged_data.append(key) 
开发者ID:ncorbuk,项目名称:Python-Keylogger,代码行数:31,代码来源:Python advanced keylogger.py

示例12: get_window_title

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def get_window_title(hwnd):
    return win32gui.GetWindowText(hwnd) 
开发者ID:ActivityWatch,项目名称:aw-watcher-window,代码行数:4,代码来源:windows.py

示例13: _chosegamehandle

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def _chosegamehandle(self,HWND):
            if not HWND : return HWND
            else:
                for handle in HWND:
                    windowtext = win32gui.GetWindowText(handle)
                    if ":" not in windowtext: 
                        return handle 
开发者ID:NetEase,项目名称:airtest,代码行数:9,代码来源:windows.py

示例14: _windowEnumerationHandler

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def _windowEnumerationHandler(self, hwnd, resultList):
        #
        # Get a list of the top level windows so I can find Program Manager
        #
        resultList.append((hwnd, win32gui.GetWindowText(hwnd))) 
开发者ID:ActiveState,项目名称:code,代码行数:7,代码来源:recipe-576821.py

示例15: getWindowText

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetWindowText [as 别名]
def getWindowText(hwnd):
    return win32gui.GetWindowText(hwnd) 
开发者ID:ynzheng,项目名称:pyautotrade_tdx,代码行数:4,代码来源:winguiauto.py


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