[python-win32] Emulate a keystroke for Kbhit function (Conio.h)
Tim Golden
mail at timgolden.me.uk
Tue Apr 10 14:48:33 CEST 2007
Frank Günther wrote:
> I've automated a console application using win32pipe.popen2 by capturing the
> output stream and writing the input stream. So far it works fine but the
> console application uses Kbhit() from conio.h in some cases. Is there a
> possibility to fill the keyboard buffer and emulate a keystroke for the
> process opened by win32pipe?
> Win32api.SendMessage can't be used because there is no window for the
> console application. The user keystrokes are captured by my wx-application
> that automates the console application but I don't know how to forward the
> keystroke to Kbhit.
Not at all my area, I'm afraid, but I have thought about
it a bit. Console windows do have a window handle (which
you can get hold of via the win32console functions) so
there *might* be a way of sending keys to it, but I'm
not at all sure of the interactions between the Windows
messaging and c-lib things like kbhit.
This is really pexpect territory which doesn't seem to
be available under Windows (unless you're prepared to
try Cygwin which I can never bring myself to like).
TJG
More information about the Python-win32
mailing list