예제 #1
0
 def get_shell_window():
     """
     @rtype:  L{Window}
     @return: Returns the shell window.
     @raise WindowsError: An error occured while processing this request.
     """
     return Window( win32.GetShellWindow() )
예제 #2
0
 def get_desktop_window():
     """
     @rtype:  L{Window}
     @return: Returns the desktop window.
     @raise WindowsError: An error occured while processing this request.
     """
     return Window( win32.GetDesktopWindow() )
예제 #3
0
 def get_foreground_window():
     """
     @rtype:  L{Window}
     @return: Returns the foreground window.
     @raise WindowsError: An error occured while processing this request.
     """
     return Window( win32.GetForegroundWindow() )
예제 #4
0
    def find_window(className = None, windowName = None):
        """
        Find the first top-level window in the current desktop to match the
        given class name and/or window name. If neither are provided any
        top-level window will match.

        @see: L{get_window_at}

        @type  className: str
        @param className: (Optional) Class name of the window to find.
            If C{None} or not used any class name will match the search.

        @type  windowName: str
        @param windowName: (Optional) Caption text of the window to find.
            If C{None} or not used any caption text will match the search.

        @rtype:  L{Window} or None
        @return: A window that matches the request. There may be more matching
            windows, but this method only returns one. If no matching window
            is found, the return value is C{None}.

        @raise WindowsError: An error occured while processing this request.
        """
        # I'd love to reverse the order of the parameters
        # but that might create some confusion. :(
        hWnd = win32.FindWindow(className, windowName)
        if hWnd:
            return Window(hWnd)
예제 #5
0
    def get_window_at(x, y):
        """
        Get the window located at the given coordinates in the desktop.
        If no such window exists an exception is raised.

        @see: L{find_window}

        @type  x: int
        @param x: Horizontal coordinate.
        @type  y: int
        @param y: Vertical coordinate.

        @rtype:  L{Window}
        @return: Window at the requested position. If no such window
            exists a C{WindowsError} exception is raised.

        @raise WindowsError: An error occured while processing this request.
        """
        return Window( win32.WindowFromPoint( (x, y) ) )