Software keyboard

Mike vimakefile at yahoo.com
Thu Nov 24 20:11:54 CET 2005


You need to call keybd_event which is (or was in win3.x - win95 at least) in 
USER32.DLL.

Simulate return keypress:
    keybd_event(VK_RETURN,0,0,0);
    keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0);

Google turned this up: 
http://www.howtodothings.com/viewarticle.aspx?article=395
Note: This is old stuff -- you'll need to handle different versions of 
windows where that DLL and API are rennamed -- I beleive it is now 
SendInput.

SendMessage and Windows hooks can also work, but not as well in all 
circumstances.

If you feel nervous about programming this, you can probably find/buy a COM 
component that will do this and call it from Python that way.

But, this would seem to fit the bill out-of-the-box: 
http://rutherfurd.net/python/sendkeys/index.html

m


"maxxx_77" <massimopone at libero.it> wrote in message 
news:1132819597.002388.114480 at g14g2000cwa.googlegroups.com...
> Hello. I'm a newbye of Python.
> I'm looking for a way of coding a virtual keyboard similar to the one
> that comes with Windows (Accessories -> Accessibility -> On Screen
> Keyboard).
> What I would like to do is make one which is a lot larger and add
> transparency to it.
> I've a first version in which I used TKinter and Pythonwin.
> Can anyone provide me with a snipet of code which would explain how to
> send characters to other applications?
> The first difficulty that I have is to find which application is active
> and has the focus. I think that my keyboard application must be
> modeless and cannot receive the focus. But how?
> Please help me.
> Bye.
> 





More information about the Python-list mailing list