[python-win32] Help on using win32api.SendMessage to send
keystrokes
Tim Roberts
timr at probo.com
Tue Apr 5 19:55:33 CEST 2005
Daniel F wrote:
>How about getkeyboardstate/setkeyboardstate functions, put together
>with attachthreadinput? would that be on the keyboard driver level,
>above directinput? or still below it, and thus bypassed?
>
>
Actually, after doing some more reading, there may be a way to do what
you want with the SendInput API. I don't see SendInput in any of the
Win32 wrappers in Python, but you should be able to access it with
ctypes. Here's a link to some C# code that demonstrates it:
http://split-s.blogspot.com/2005/01/emulating-keystrokes-in-windows.html
Note that this wants scan codes, not virtual keys.
>Also... why don't i really want to do the kernel filter drivers? They
>certainly sound like i dont want to do them :) but i wonder why. Too
>involved and painful? Chance to screw up the whole system?
>
>
The kernel world is a strange and magical one. The learning curve is
steep, and the environment is unforgiving. If you make a mistake in a
Python app, you get an exception and you try again. If you make a
mistake in a kernel driver, you get a bluescreen and you reboot, and you
hope that the NTFS file system remembered to flush the pending changes
to disk.
I write drivers for a living.
--
- Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list