Virtual keyboard management with Win32 API

  • Thread starter Thread starter vidoine
  • Start date Start date
V

vidoine

Guest
Hello,

with my team we are developing a C++ Windows application which is based on Qt library for the UI part and on Win32 API for the rest.

The minimum Windows version supported is Windows 8.1.

We have some troubles to deal with the virtual keyboard. Indeed, due to some restrictions we can't use the Qt virtual keyboard and we have to handle the Windows virtual keyboard instead. The main issue is the possibility to detect if the keyboard is opened or not and to get its position, this to always display any text field of the application above the virtual keyboard.

To do this we use the FindWindow function with different parameters, this to support several versions of Windows.

"IPTIP_Main_Window" for version before 1803

First child of ApplicationFrameWindow which is a Windows.UI.Core.CoreWindow window and has the caption "Microsoft Text Input Application" for version after 1803.

In both cases the GetWindowLong function is used to get the GWL_STYLE value in order to know if the window is visible or not.

The GetWindowRect function is used to get the position of the keyboard.

The main problem is that depending on the Windows version of the user and on the update version this feature works or not.

Each time a new Windows update version was released we had to adapt our code in order to support this new version.

It will be very tedious and heavy for us to continue in this way.

I'd like to know if there is any Win32 API component that we could use to get access to the virtual keyboard and to check its visibility and position.

Regards,

M Vidoine

Continue reading...
 
Back
Top