Software keyboard

M

maxxx_77

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.
 
M

Mike

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,271
Messages
2,571,354
Members
48,042
Latest member
DoraMcBrie

Latest Threads

Top