[python-win32] Help on using win32api.SendMessage to send keystrokes

Daniel F nanotube at gmail.com
Mon Apr 4 23:28:09 CEST 2005


Thank you all for your suggestions. Seems like i had this all figured out... 

But now I am running into another problem. I was originally planning
to use this on a game (final fantasy 7, in fact). I capture keystrokes
in the system, then send them over the net and generate them on the
remote comp, thus playing the game simultaneously and synchronously on
two comps at once. Worked like a charm for any old windows app,
including notepad that I used as my test app.

But turns out ff7 uses directinput to get its keys (apparently...)
because "normal" hooking of messages through SetWindowHookEx
(actually, i'm using the pyHook package, which makes the process more
pleasant, but is just a wrapper around the said function) doesnt work
properly, nor does "normal" message injection through PostMessage.

So, in a completely different tack, could anyone help me understand
the relationship between directinput and the regular windows hook
chain (so far it seems that directinput bypasses it completely), and
how i would hook those keypresses/mouse moves, and how i would inject
a keypress/mousemove for an application that is using directinput? Is
that even possible?

I wouldnt even be averse (or at least, not THAT averse) to getting at
it through SWIG, if win32all doesnt wrap directx api... Just let me
know if there is any way to get at it. I've looked around on the web
about DirectX and DirectInput, but all i have found was processing
inputs through directinput, not hooking messages on the system level
(ie, getting my hands on messages being passed to an application other
than the one thats doing the hooking).

Would appreciate any and all help in this matter.

Thank you,
Daniel


More information about the Python-win32 mailing list