Exemple #1
0
    def restore(self):

        # By doing normal way with EnumWindows() and then IsWindowVisible
        # I got about five thousand top-level windows. It sucks.
        # So I just walk through desktop region and to enumerate windows

        minx = self.d.right - self.margin - self.size; maxx = minx + self.size
        miny = self.margin; maxy = self.margin + self.size

        #print minx,miny,maxx,maxy

        p = POINT()
        step = 1; currx = minx;
        prev_hwnd = None
        wnds = set()
        while (currx <= maxx):
            curry = miny;
            while (curry <= maxy):
                p.x = currx; p.y = curry;
#                print currx, curry
                curry = curry + step
                
                hwnd = self.WindowFromPoint(p)
                if (hwnd in wnds):
                    continue
                wnds.add(hwnd)
                self.InvalidateRect(hwnd, self.d, True)
                self.UpdateWindow(hwnd)
                #print p.x, p.y
            currx = currx + step
Exemple #2
0
def map_to_window(x, y):
    '''x and y are normalized coordinates.'''
    width = GetSystemMetrics(SM_CXSCREEN)
    height = GetSystemMetrics(SM_CYSCREEN)
    point = POINT(2)
    point.x = int(x * width)
    point.y = int(y * height)
    MapWindowPoints(0, hwnd, point, 1)
    return point.x, point.y
Exemple #3
0
 async def init_silent_mode(self):
     if self.silent_mode and not self.silent_init:
         point = POINT()
         point.x = 100
         point.y = 100
         ctypes.windll.user32.ClientToScreen(self.window_handle,
                                             ctypes.byref(point))
         self.silent_xpos = point.x
         self.silent_ypos = point.y
         await self.walker.mouse_handler.set_mouse_position(
             self.silent_xpos, self.silent_ypos, convert_from_client=False)
         self.silent_init = True
Exemple #4
0
from time import sleep
from ctypes import *
from ctypes.wintypes import POINT
user32 = windll.user32

SCAN_F5 = 63
VK_F5 = 0x74

sleep(10)

p = POINT()
p.x = 570
p.y = 349

MOUSEEVENTF_LEFTDOWN = 0x0002

MOUSEEVENTF_LEFTUP = 0x0004

while True:
    user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    sleep(0.1)
    user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    sleep(0.1)
    user32.keybd_event(VK_F5, SCAN_F5, 0, 0)
    sleep(0.1)
    user32.keybd_event(VK_F5, SCAN_F5, 0x0002, 0)
    sleep(8)
Exemple #5
0
 def to_wintypes(self):
     point = POINT()
     point.x = self.x,
     point.y = self.y
     return point