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


Python win32gui.GetClassName方法代码示例

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


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

示例1: dumpWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [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: foreach_child

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def foreach_child(self):
        def callback(hwnd, window_hwnd):
            classname = win32gui.GetClassName(hwnd).lower()

            buffer_len = win32gui.SendMessage(hwnd, win32con.WM_GETTEXTLENGTH, 0, 0) + 1
            text = array('b', b'\x00\x00' * buffer_len)
            text_len = win32gui.SendMessage(hwnd, win32con.WM_GETTEXT, buffer_len, text)
            text = win32gui.PyGetString(text.buffer_info()[0], buffer_len - 1).lower()

            for match in self._windows[window_hwnd]['matches']:
                if match["text"] in text:
                    self._windows[window_hwnd]['to_click'].append(match["button"])

            if "button" in classname:
                self._windows[window_hwnd]['buttons'].append({
                    'text': text,
                    'handle': hwnd,
                })

            return True

        return callback 
开发者ID:certsocietegenerale,项目名称:fame_modules,代码行数:24,代码来源:cutthecrap.py

示例3: dumpSpecifiedWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [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

示例4: dumpWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [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

示例5: __call__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [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

示例6: __call__

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def __call__(self, only_sel = False):
        self.only_sel = only_sel
        res = []
        for hwnd in GetTargetWindows():
            if not IsWindow(hwnd):
                self.PrintError("Not a window")
                continue
            clsName = GetClassName(hwnd)
            if not IsChild(GetParent(hwnd), hwnd) or clsName in win32_ctrls['statics']:
                val = eg.WinApi.GetWindowText(hwnd)
            elif clsName in win32_ctrls['edits']:
                val = self.getEditText(hwnd)
            elif clsName in win32_ctrls['combos']:
                val = self.getComboboxItems(hwnd)
            elif clsName in win32_ctrls['listboxes']:
                val = self.getListboxItems(hwnd)
            elif clsName in win32_ctrls['listviews']:
                val = self.getListViewItems(hwnd)
            elif match_cls(clsName, win32_ctrls['statusbars']):
                val = self.getStatusBarItems(hwnd)
            else:
                val = None
            res.append(val)
        return res 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:26,代码来源:__init__.py

示例7: _MyCallback

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def _MyCallback( hwnd, extra ):
    hwnds, classes = extra
    hwnds.append(hwnd)
    classes[win32gui.GetClassName(hwnd)] = 1 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:6,代码来源:win32gui_demo.py

示例8: _windowEnumerationHandler

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def _windowEnumerationHandler(hwnd, resultList):
    '''Pass to win32gui.EnumWindows() to generate list of window handle,
    window text, window class tuples.'''
    resultList.append((hwnd,
                       win32gui.GetWindowText(hwnd),
                       win32gui.GetClassName(hwnd))) 
开发者ID:ynzheng,项目名称:pyautotrade_tdx,代码行数:8,代码来源:winguiauto.py

示例9: _enumWindows

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def _enumWindows(self, hwnd, _):
        """遍历回调函数"""
        if hwnd == self.myhwnd:
            return  # 防止自己嵌入自己
        if win32gui.IsWindow(hwnd) and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
            phwnd = win32gui.GetParent(hwnd)
            title = win32gui.GetWindowText(hwnd)
            name = win32gui.GetClassName(hwnd)
            self.windowList.addItem(
                '{0}|{1}|\t标题:{2}\t|\t类名:{3}'.format(hwnd, phwnd, title, name)) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:12,代码来源:EmbedWindow.py

示例10: _windowEnumerationHandler

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def _windowEnumerationHandler(hwnd, resultList):
    """Pass to win32gui.EnumWindows() to generate list of window handle,
    window text, window class tuples."""
    resultList.append((hwnd,
                       win32gui.GetWindowText(hwnd),
                       win32gui.GetClassName(hwnd))) 
开发者ID:drongh,项目名称:pyAutoTrading,代码行数:8,代码来源:winguiauto.py

示例11: FindSasWindow

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def FindSasWindow():
	hDesktop = win32service.OpenDesktop("Winlogon", 0, False,
		win32con.DESKTOP_READOBJECTS  | win32con.DESKTOP_ENUMERATE)
	for hWindow in hDesktop.EnumDesktopWindows():
		if win32gui.GetClassName(hWindow) == "SAS window class":
			return hDesktop, hWindow 
开发者ID:grawity,项目名称:code,代码行数:8,代码来源:wts.py

示例12: get_info_windows

# 需要导入模块: import win32gui [as 别名]
# 或者: from win32gui import GetClassName [as 别名]
def get_info_windows():
    """
    Reads the window titles to get the data.

    Older Spotify versions simply use FindWindow for "SpotifyMainWindow",
    the newer ones create an EnumHandler and flood the list with
    Chrome_WidgetWin_0s
    """

    import win32gui

    windows = []

    old_window = win32gui.FindWindow("SpotifyMainWindow", None)
    old = win32gui.GetWindowText(old_window)

    def find_spotify_uwp(hwnd, windows):
        text = win32gui.GetWindowText(hwnd)
        classname = win32gui.GetClassName(hwnd)
        if classname == "Chrome_WidgetWin_0" and len(text) > 0:
            windows.append(text)

    if old:
        windows.append(old)
    else:
        win32gui.EnumWindows(find_spotify_uwp, windows)

    # If Spotify isn't running the list will be empty
    if len(windows) == 0:
        raise SpotifyClosed

    # Local songs may only have a title field
    try:
        artist, track = windows[0].split(" - ", 1)
    except ValueError:
        artist = ''
        track = windows[0]

    # The window title is the default one when paused
    if windows[0].startswith('Spotify'):
        raise SpotifyPaused

    return track, artist 
开发者ID:SwagLyrics,项目名称:SwSpotify,代码行数:45,代码来源:spotify.py


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