Python ctypes.windll.user32() Examples

The following are 15 code examples for showing how to use ctypes.windll.user32(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module ctypes.windll , or try the search function .

Example 1
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 6 votes vote down vote up
def queryMousePosition():
	pt = POINT()
	windll.user32.GetCursorPos(byref(pt))
	return { "x": pt.x, "y": pt.y} 
Example 2
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def queryMousePosition():
	pt = POINT()
	windll.user32.GetCursorPos(byref(pt))
	return { "x": pt.x, "y": pt.y} 
Example 3
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
		threading.Thread.__init__(self, *args, **kwargs)
		self.hooked  = None
		self.daemon=True
		self.lUser32=user32
		self.pointer=None
		self.stopped=False
		self.screenshots=[] 
Example 4
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def run(self):
		if self.install_hook():
			print "mouselogger installed"
		else:
			raise RuntimeError("couldn't install mouselogger")
		msg = MSG()
		user32.GetMessageA(byref(msg),0,0,0)
		while not self.stopped:
			time.sleep(1)
		self.uninstall_hook() 
Example 5
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def hook_proc(self, nCode, wParam, lParam):
		##http://www.pinvoke.net/default.aspx/Constants.WM
		if wParam == 0x201:
			buf, height, width = self.get_screenshot()
			self.screenshots.append((datetime.datetime.now(), height, width, buf))
		return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam) 
Example 6
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def run(self):
		if self.install_hook():
			print "mouselogger installed"
		else:
			raise RuntimeError("couldn't install mouselogger")
		msg = MSG()
		user32.GetMessageA(byref(msg),0,0,0)
		while not self.stopped:
			time.sleep(1)
		self.uninstall_hook() 
Example 7
Project: NoobSec-Toolkit   Author: krintoxi   File: mouselogger.py    License: GNU General Public License v2.0 5 votes vote down vote up
def hook_proc(self, nCode, wParam, lParam):
		##http://www.pinvoke.net/default.aspx/Constants.WM
		if wParam == 0x201:
			buf, height, width = self.get_screenshot()
			self.screenshots.append((datetime.datetime.now(), height, width, buf))
		return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam) 
Example 8
Project: DeepFaceLab   Author: iperov   File: osex.py    License: GNU General Public License v3.0 5 votes vote down vote up
def set_process_dpi_aware():
    if sys.platform[0:3] == 'win':
        windll.user32.SetProcessDPIAware(True) 
Example 9
Project: DeepFaceLab   Author: iperov   File: osex.py    License: GNU General Public License v3.0 5 votes vote down vote up
def get_screen_size():
    if sys.platform[0:3] == 'win':
        user32 = windll.user32
        return user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
    elif 'darwin' in sys.platform:
        pass
    elif 'linux' in sys.platform:
        pass
        
    return (1366, 768) 
Example 10
Project: servoshell   Author: paulrouget   File: build_commands.py    License: Mozilla Public License 2.0 5 votes vote down vote up
def notify_win(title, text):
    try:
        from servo.win32_toast import WindowsToast
        w = WindowsToast()
        w.balloon_tip(title, text)
    except:
        from ctypes import Structure, windll, POINTER, sizeof
        from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT

        class FLASHWINDOW(Structure):
            _fields_ = [("cbSize", UINT),
                        ("hwnd", HANDLE),
                        ("dwFlags", DWORD),
                        ("uCount", UINT),
                        ("dwTimeout", DWORD)]

        FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
        FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
        FLASHW_CAPTION = 0x01
        FLASHW_TRAY = 0x02
        FLASHW_TIMERNOFG = 0x0C

        params = FLASHWINDOW(sizeof(FLASHWINDOW),
                             windll.kernel32.GetConsoleWindow(),
                             FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
        FlashWindowEx(params) 
Example 11
Project: RebirthItemTracker   Author: Hyphen-ated   File: pygameWindowInfo.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def __init__(self):
        """Initialize our object"""
        # Find the start x,y pos of the main pygame *screen* (the screen in the
        # window):
        sdlpos = os.getenv("SDL_VIDEO_WINDOW_POS")
        if sdlpos is None:
            raise Exception("Must have previously setup a Pygame window starting position via the 'SDL_VIDEO_WINDOW_POS' evn var.")
        self.initPygameScreenPos = [int(i) for i in sdlpos.split(",")]

        # Run our ctypes code to query window position:
        try:
            # It's said that not all systems support this dictionary key.  I'm
            # not sure what systmes those are, but might as well put a check in.
            self.hwnd = pygame.display.get_wm_info()["window"]
        except KeyError:
            raise Exception("Your system isn't accepting the code: 'pygame.display.get_wm_info()[\"window\"]', must not be supported :-(")
        self.prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))
        self.paramflags = (1, "hwnd"), (2, "lprect")
        self.GetWindowRect = self.prototype(("GetWindowRect", windll.user32), self.paramflags)

        # Find the initial *window* position:
        rect = self.GetWindowRect(self.hwnd)
        # Calculate the thickness of the *window* border to the *screen* object inside:
        self.borderThickness = int(self.initPygameScreenPos[0]) - rect.left
        self.titleThickness = int(self.initPygameScreenPos[1]) - rect.top
        # borderThickness is the left, right, and bottom window edges.  titleThickness
        # is th thickness of the top title-bar of the window. 
Example 12
Project: backdoorme   Author: Kkevsterrr   File: mouselogger.py    License: MIT License 5 votes vote down vote up
def queryMousePosition():
	pt = POINT()
	windll.user32.GetCursorPos(byref(pt))
	return { "x": pt.x, "y": pt.y} 
Example 13
Project: backdoorme   Author: Kkevsterrr   File: mouselogger.py    License: MIT License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
		threading.Thread.__init__(self, *args, **kwargs)
		self.hooked  = None
		self.daemon=True
		self.lUser32=user32
		self.pointer=None
		self.stopped=False
		self.screenshots=[] 
Example 14
Project: backdoorme   Author: Kkevsterrr   File: mouselogger.py    License: MIT License 5 votes vote down vote up
def run(self):
		if self.install_hook():
			print "mouselogger installed"
		else:
			raise RuntimeError("couldn't install mouselogger")
		msg = MSG()
		user32.GetMessageA(byref(msg),0,0,0)
		while not self.stopped:
			time.sleep(1)
		self.uninstall_hook() 
Example 15
Project: backdoorme   Author: Kkevsterrr   File: mouselogger.py    License: MIT License 5 votes vote down vote up
def hook_proc(self, nCode, wParam, lParam):
		##http://www.pinvoke.net/default.aspx/Constants.WM
		if wParam == 0x201:
			buf, height, width = self.get_screenshot()
			self.screenshots.append((datetime.datetime.now(), height, width, buf))
		return user32.CallNextHookEx(self.hooked, nCode, wParam, lParam)