Dear all, I've noticed that the Win32 SendInput <https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput> API function is not currently exposed by any pywin32 module. I was wondering if this function could be exposed in win32api, where the related keybd_event and mouse_event functions are already present. I am aware that SendInput can be used via ctypes, I just think it would be nice if the function could also be used via pywin32.
As I see it, the main benefit of using SendInput over the keybd_event and mouse_event functions is that you can pass an array of events for the system to send, rather than one event per call. Microsoft's documentation also states that the aforementioned functions have been superseded by SendInput. The INPUT <https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-input> structures expected by SendInput can also be used to specify timestamps for each keyboard and mouse event. SendInput could be exposed via a wrapper function taking a single list or tuple to be converted to the array of INPUT structures required for the |||pInputs| parameter. The cInputs and cbSize parameters could then be derived from the list internally. Each list element could be a tuple of struct members starting with the INPUT type (0-2). Alternatively, the new function could require each list item to use Python structs defined in win32api or elsewhere. While I do have some experience working with the C-Python API, I don't think I could implement and test this myself because it looks like pywin32's build process is /very/ complicated. Let me know your thoughts! All the best, Dane Finlay
_______________________________________________ python-win32 mailing list python-win32@python.org https://mail.python.org/mailman/listinfo/python-win32