简体   繁体   中英

How to simulate keydown events using win32api in python?

Specifically using the keybd_event() function? Do I have to use a while loop to "hold down" the key, or is there a proper way to do this?

SendInput is better than keybd_event but either way, you tell the function when a key is pressed and call it again to release a key, you don't have to keep calling the function to keep the key pressed.

If possible, consider using UI Automation instead of faking input.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM