Foros


Comfort Software :: Foros :: Development
<< Tema anterior | Tema siguiente >>   

How to show/close/fade the On-Screen Keyboard

Ir a la página       >>  
Autor Mensaje
Comfort
Fri Oct 19 2007, 03:20AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
You can use Window Messages to manipulate the on-screen keyboard.

Like this:

WM_CSKEYBOARD = WM_USER + 192;

PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 1, 0); - to show keyboard
PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 2, 0); - to close keyboard
PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 3, 0); - to fade keyboard

Here is a program that can do this: http://www.comfort-software.com/download/ManipulateKB.zip

Also you can find Sample Code for other language in help file.

If you can't use Windows Messages then download and try these files:
http://www.comfort-software.com/download/ShowKB.exe
http://www.comfort-software.com/download/HideKB.exe
http://www.comfort-software.com/download/ToggleKB.exe


[ Editado Wed Apr 21 2010, 09:42AM ]

Have a nice day
Volver arriba
Kevin
Tue Jan 08 2008, 12:38PM
Miembro registrado #42
Unido: Tue Jan 08 2008, 11:41AM
Mensajes: 2
I really like your on-screen keyboard. I am working on a proof of concept for my company. I'm having a difficult time getting the keyboard to show/hide via the Windows Messages. I'm developing a winforms C# kiosk application. An example of how to implement this would be most helpful... Thanks
Volver arriba
Comfort
Tue Jan 08 2008, 01:11PM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
I cannot write example for C#. Maybe somebody else?
Here is 2 main functions from WinAPI:
  • PostMessage
  • FindWindow

You can find description of these functions in help.

-------------------
For example, for Visual Basic it looks like this:

Private Const WM_CSKEYBOARD = WM_USER + 192

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

‘Code to show keyboard
Dim hWnd As Long
hWnd = FindWindow(“TFirstForm”, “CKeyboardFirstForm”)
PostMessage hWnd, WM_CSKEYBOARD, 1, 0

‘Code to close keyboard
Dim hWnd As Long
hWnd = FindWindow(“TFirstForm”, “CKeyboardFirstForm”)
PostMessage hWnd, WM_CSKEYBOARD, 2, 0
-------------------


Have a nice day
Volver arriba
Kevin
Tue Jan 08 2008, 01:58PM
Miembro registrado #42
Unido: Tue Jan 08 2008, 11:41AM
Mensajes: 2
Thanks for your quick reply ... you got me headed in the right direction.

Here is the code in C# (almost exactly as you describe in VB)

public const Int32 WM_USER = 1024;
public const Int32 WM_CSKEYBOARD = WM_USER + 192;

[DllImport("user32.dll", EntryPoint = "FindWindow")]
private static extern Int32 FindWindow(string _ClassName, string _WindowName);

[DllImport("User32.DLL")]
public static extern Boolean PostMessage(Int32 hWnd, Int32 Msg, Int32 wParam, Int32 lParam);


Int32 hWnd = FindWindow("TFirstForm", "CKeyboardFirstForm");
PostMessage(hWnd, WM_CSKEYBOARD, 1, 0 ); // Show
PostMessage(hWnd, WM_CSKEYBOARD, 2, 0); // Hide


Now that I have that working... I've got a couple more questions -

1 - Is there a way to position the keyboard without any user intervention? Would i do this through an API call? I kind a new at the API interface - please bare with me.

2- Is there a way to disable/hide/remove the close and autohide icons?

Thank You - you have been most helpful!
Volver arriba
Comfort
Wed Jan 09 2008, 08:02AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
1. Please, download new beta version: http://www.comfort-software.com/beta/kb_setup.exe
In this version you can also use Window Messages to move the on-screen keyboard.

Like this:
-----------------
WM_CSKEYBOARDMOVE = WM_USER + 193;

PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARDMOVE, Left, Top);
----------------------------
Left, Top - new position

2. You can restrict access: http://www.comfort-software.com/forum-t49.html

Have a nice day
Volver arriba
Miguel
Thu Jan 17 2008, 12:15PM
Miembro registrado #46
Unido: Thu Jan 17 2008, 10:16AM
Mensajes: 2
Hi,
I was wondering if it is possible to use the code
PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 1, 0);
and get the autohide to work correctly?

I am trying to use the On-Screen Keyboard on a touchscreen without a keyboard.
The computer is used in a tourism office with a web page (IExplorer in full screen) .
I wanted to make the on-screen keyboard visible when the user enters a text field (used to search) but hide it if the users does not "type" anything in a couple of seconds.

Thanks
Volver arriba
Comfort
Fri Jan 18 2008, 06:57AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
Please, use two messages together:

PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 1, 0);
PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 3, 0);

Have a nice day
Volver arriba
Miguel
Tue Jan 22 2008, 07:14PM
Miembro registrado #46
Unido: Thu Jan 17 2008, 10:16AM
Mensajes: 2
Thanks, that worked!
The problem was that I thought that "Fade" was "start to fade and dissapear NOW"
Volver arriba
Mads Pedersen
Mon Jan 28 2008, 05:14AM
Miembro registrado #50
Unido: Mon Jan 28 2008, 05:00AM
Mensajes: 2
Hi,
We are using the On-Screen Keyboard and WM_CSKEYBOARD to show and hide the keyboard from our application. It works great.

Is there a way to toggle the keyboard (not shown to shown and vice versa)? Or to find out if the keyboard is shown via a .NET or WIN32 call?
The case is that the user can push the "X" on the keyboard to hide it, as well as a button in our application can toggle the keyboard. This means that if the user pushes "X", our application comes out of sync, as it thinks the keyboard is shown and consequently hides it (again).

Thank you in advance,
Mads Pedersen
Volver arriba
Comfort
Mon Jan 28 2008, 07:03AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
Mads Pedersen escribió ...

Is there a way to toggle the keyboard (not shown to shown and vice versa)? Or to find out if the keyboard is shown via a .NET or WIN32 call?
The case is that the user can push the "X" on the keyboard to hide it, as well as a button in our application can toggle the keyboard. This means that if the user pushes "X", our application comes out of sync, as it thinks the keyboard is shown and consequently hides it (again).


Please, download new beta version and use this command:
PostMessage(FindWindow('TFirstForm', 'CKeyboardFirstForm'), WM_CSKEYBOARD, 4, 0);

But I recommend you restrict access: http://www.comfort-software.com/forum-t49.html

Also, in new beta you can use new option Hide the icon in the system tray. It may be useful for you.

Have a nice day
Volver arriba
Mads Pedersen
Mon Jan 28 2008, 09:59AM
Miembro registrado #50
Unido: Mon Jan 28 2008, 05:00AM
Mensajes: 2
Thanks for the quick response!

The toggle functionality (WM_CSKEYBOARD, 4) works perfectly .
In our application, it is still fine if the user could move the keyboard around the screen (could be nice if only the "X" could be restricted).

Otherwise the toggle function is great. You mention that it is a beta version. Should we wait to ship that version until it is stable? Have you got an idea of when it is released?

Also great that the systray icon can be hidden.

Thank you!
Volver arriba
Comfort
Tue Jan 29 2008, 03:36AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
Last beta version is stable enough. You can use it.

Have a nice day
Volver arriba
bhaumikgadani
Sat Mar 08 2008, 03:55AM
Miembro registrado #76
Unido: Sat Mar 08 2008, 03:12AM
Mensajes: 1
hi i have download the keyboard.
and i want to use it in kiosk application in vb6(winxp). i have made the programme for that
by reading online docs.. i m not expert in vb6,
i want to show the keyboard when form active,,,

for that i have add module and paste following code in that

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const WM_CSKEYBOARD = 1280

and i have add form and paste following code in it in form load event

Dim hWnd As Long

hWnd = FindWindow(“TFirstForm”, “CKeyboardFirstForm”)
PostMessage hWnd, WM_CSKEYBOARD, 1, 0

its show the error of PostMessage - sub or function not defined....

i searched a lot online but didnt get so please can anyone tell the solution for the same.
and after solving it , is it show the keyboard? if not show than please can u tell me where we
have to put code so it will run perfectly...

thanks in advance.

Regards
bhaumik
Volver arriba
Comfort
Sat Mar 08 2008, 09:30AM


Unido: Wed Sep 19 2007, 03:42PM
Mensajes: 617
I think this code may help you: here

[ Editado Wed Mar 12 2008, 01:29AM ]

Have a nice day
Volver arriba
lhearin
Wed Mar 18 2009, 12:36PM
Miembro registrado #272
Unido: Wed Mar 18 2009, 12:24PM
Mensajes: 1
A suggestion for your implementation:

You should use really use WM_APP as your base message number instead of WM_USER. Microsoft makes use of WM_USER + n for many internal messages so it can cause operational issues if there is a conflict. Originally anything above WM_USER was for developers to use but Microsoft ran out of messages below that for their own use. That's why they created WM_APP. They won't use any internal message above that. Even using WM_APP as your base is not foolproof. It would be better still to use a registered Windows message. See the article at http://www.flounder.com/messages.htm.
Volver arriba
Ir a la página       >>  
Moderadores: Comfort

Saltar:     Volver arriba

Sindicalizar este hilo: rss 0.92 Sindicalizar este hilo: rss 2.0 Sindicalizar este hilo: RDF
Powered by e107 Forum System