Page 1 of 1

programatically control the Windows OnScreen keyboard.

PostPosted: October 12th, 2010, 8:41 pm
by Blod
Hello to All,

I want to be able to programatically control the Windows OnScreen keyboard.

I found the following code online which seemed to be the answer.

it said...

You can use Window Messages to manipulate the on-screen keyboard.

Like this:

WM_CSKEYBOARD = WM_USER + 192;
WM_CSKEYBOARDMOVE = WM_USER + 193;

// to show keyboard
PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARD, 1, 0);

// to close keyboard
PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARD, 2, 0);

// to fade keyboard
PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARD, 3, 0);

// to toggle (show/hide) keyboard
PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARD, 4, 0);

// to move keyboard (Left, Top - new position)
PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARDMOVE, Left, Top);

I declared

Const
WM_CSKEYBOARD = WM_USER + 192;
WM_CSKEYBOARDMOVE = WM_USER + 193;

in the implimentation part of my unit

and

put

PostMessage(FindWindow('TFirstForm', 'hvkFirstForm'), WM_CSKEYBOARD, 1, 0);

in a buttons onclick event.

It compiles and runs Ok but nothing happens when the button is clicked.

What am I failing to do please?

Thanks

Blod

Re: programatically control the Windows OnScreen keyboard.

PostPosted: October 12th, 2010, 10:13 pm
by Kambiz
The code you are using, is for controlling Hot Virtual Keyboard and doesn't work for Windows on Screen Keyboard.

Re: programatically control the Windows OnScreen keyboard.

PostPosted: October 13th, 2010, 7:53 am
by Blod
Thanks,
I didn't realise that.

Blod