def from_point(cls, x, y):
     current_handle = win32gui.WindowFromPoint((x, y))
     child_handle = win32gui.ChildWindowFromPoint(current_handle, (x, y))
     if child_handle:
         return cls(child_handle)
     else:
         return cls(current_handle)
def get_child_window_at_coordinates(x, y):
    '''Returns the handle of the first child window at (x,y) screen coordinates.
    
    Returns None if no child window contains the coordinates.
    '''
    parent_handle = win32gui.WindowFromPoint((x, y))
    if parent_handle == 0: parent_handle = None
    child_handle = None
    if (parent_handle != None):
        child_handle = win32gui.ChildWindowFromPoint(parent_handle, (x, y))
        if child_handle == 0: child_handle = None
        if child_handle == parent_handle: child_handle = None
    return child_handle
def get_window_tree_at_coordinates(x, y):
    '''Returns a list of window handles at (x,y) screen coordinates.
    
    The first handle in the list is the parent window. The other handles 
    are the first child window of the previous handle that contains the 
    coordinates. These are iteratively found with 
    get_child_window_at_coordinates(x, y). 
    '''
    window_handles = []
    parent_handle = get_parent_window_at_coordinates(x, y)
    while parent_handle != None:
        window_handles.append(parent_handle)
        child_handle = win32gui.ChildWindowFromPoint(parent_handle, (x, y))
        if child_handle == 0: child_handle = None
        if child_handle == parent_handle: parent_handle = None
        else: parent_handle = child_handle
    return window_handles
Esempio n. 4
0
 def GetChildWinFromPoint(cls, parent_whd, point):
     return win32gui.ChildWindowFromPoint(parent_whd, point)
Esempio n. 5
0
 def search_children_handle_from_parent(self, class_name):
     children_handle = win32gui.FindWindowEx(self.handle, 0, class_name, None)
     win32gui.ChildWindowFromPoint()
     return children_handle
Esempio n. 6
0
import time
import pywintypes

while(1):
    pt = win32gui.GetCursorPos()
    hwnd = win32gui.WindowFromPoint(pt)
    w0, h0, w1, h1 = win32gui.GetWindowRect(hwnd)
    focus = win32gui.GetFocus()
    #win32gui.DrawFocusRect( hwnd, (w0, h0, w1, h1))
    #win32gui.DrawEdge( hwnd, (w0, h0, w1, h1), win32con.BDR_INNER, win32con.BF_ADJUST)
    print( "my point:",w0, h0, w1, h1 )
    print( "client point:", win32gui.GetClientRect(hwnd))
    parent = win32gui.GetParent( hwnd )
    active = win32gui.GetActiveWindow()
    print("window placement: ", win32gui.GetWindowPlacement(hwnd))
    childwindow = win32gui.ChildWindowFromPoint(hwnd, win32gui.GetCursorPos())
    print( "capture : ", win32gui.GetCapture())
    window = win32gui.GetWindow(hwnd, 1)
    win32gui.SendMessage( hwnd, 1, None, None)
    desktop = win32gui.GetDesktopWindow()
    menu = win32gui.GetMenu(hwnd)
    cursorinfo = win32gui.GetCursorInfo()
    foreground = win32gui.GetForegroundWindow()
    hdc = win32gui.GetDC(hwnd)
    #win32gui.PolylineTo(hdc, ((w0, h0), (w1, h0), (w1, h1), (w0, h1), (w0,h0)))
    obj = win32gui.GetCurrentObject(hdc, win32con.OBJ_BITMAP)
    stockobj = win32gui.GetStockObject(obj)
    sysmenu  = win32gui.GetSystemMenu(hwnd, 1)