From 0b4b1ca212a92869fb686d11fc84f210fae6f5cf Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Sat, 25 Nov 2023 00:53:45 -0500 Subject: [PATCH] [+] Use win32 api for key press --- vk.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 vk.py diff --git a/vk.py b/vk.py new file mode 100644 index 0000000..1519e03 --- /dev/null +++ b/vk.py @@ -0,0 +1,15 @@ +import ctypes +from ctypes import wintypes + +# Virtual-Key codes +# RESERVED: 0xEA +VK = 0x6B +KEYEVENTF_KEYUP = 0x0002 + +def press_key(vk_code = VK): + scan_code = ctypes.windll.user32.MapVirtualKeyA(vk_code, 0) + ctypes.windll.user32.keybd_event(vk_code, scan_code, 0, 0) + +def release_key(vk_code = VK): + scan_code = ctypes.windll.user32.MapVirtualKeyA(vk_code, 0) + ctypes.windll.user32.keybd_event(vk_code, scan_code, KEYEVENTF_KEYUP, 0) \ No newline at end of file