Python win32gui.GetClassName() Examples
The following are 15
code examples of win32gui.GetClassName().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32gui
, or try the search function
.
Example #1
Source File: winguiauto.py From pyautotrade_tdx with GNU General Public License v2.0 | 13 votes |
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
Example #2
Source File: cutthecrap.py From fame_modules with GNU General Public License v3.0 | 7 votes |
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
Example #3
Source File: winguiauto.py From pyautotrade_tdx with GNU General Public License v2.0 | 6 votes |
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
Example #4
Source File: winguiauto.py From pyAutoTrading with GNU General Public License v2.0 | 6 votes |
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
Example #5
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
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 #===============================================================================
Example #6
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
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
Example #7
Source File: win32gui_demo.py From ironpython2 with Apache License 2.0 | 5 votes |
def _MyCallback( hwnd, extra ): hwnds, classes = extra hwnds.append(hwnd) classes[win32gui.GetClassName(hwnd)] = 1
Example #8
Source File: winguiauto.py From pyautotrade_tdx with GNU General Public License v2.0 | 5 votes |
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)))
Example #9
Source File: winguiauto.py From PyAutoTrading with GNU General Public License v2.0 | 5 votes |
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)))
Example #10
Source File: EmbedWindow.py From PyQt with GNU General Public License v3.0 | 5 votes |
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))
Example #11
Source File: winguiauto.py From pyautotrade_tdx with GNU General Public License v2.0 | 5 votes |
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)))
Example #12
Source File: winguiauto.py From pyAutoTrading with GNU General Public License v2.0 | 5 votes |
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)))
Example #13
Source File: win32_helper.py From pySPM with Apache License 2.0 | 5 votes |
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)))
Example #14
Source File: wts.py From code with MIT License | 5 votes |
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
Example #15
Source File: spotify.py From SwSpotify with MIT License | 4 votes |
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