There are in fact two on-screen keyboards
The older version is called osk.exe and was designed as an accessibility control
The newer version was mainly designed for use with tablets and is called tabtip.exe. This is the one I normally use and is usually loaded from my system tray area
I also have code to load both of these which is available from my article: Running Access on a Tablet PC
Suggest downloading the example app from my article to test out both on screen keyboards
The code has changed over the years in line with changes in Windows
Here are the main items of code
1. Run OSK
Code:
Option Compare DatabaseOption Explicit
'###############################################
#If VBA7 Then 'A2010 or later - 32/64-bit
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hWnd As LongPtr, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
#Else 'A2007 or earlier
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" _
(ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) _
As Long
#End If
'###############################################
Dim lngPtr As Long
'Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection, immediately after.
'Disables file system redirection for the calling thread. File system redirection is enabled by default.
#If VBA7 Then 'A2010 or later - 32/64-bit
Private Declare PtrSafe Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
Private Declare PtrSafe Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
#Else 'A2007 or earlier
Private Declare Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
Private Declare Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
#End If
Public Function RunOSK()
'=====================================================
'Colin Riddington - Mendip Data Systems
'Updated 21/06/2021
'opens on screen keyboard if opened in tablet mode
'To test it on a standard PC, disable the 'If ...End If
'NOTE: Settings have changed in recent years
' For 32-bit Access, must now Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection, immediately after.
'Alternatively enable in Windows Settings ...Ease of Access...Keyboard
'OR just press Win+Ctrl+O
'=====================================================
'If modMetrics.System(SM_TABLETPC) Then
#If Win64 Then
ShellExecute 0, "open", "osk.exe", vbNullString, "c:\", 1
#Else
Call Wow64DisableWow64FsRedirection(lngPtr)
ShellExecute 0, "open", "osk.exe", vbNullString, "c:\", 1
Call Wow64RevertWow64FsRedirection(lngPtr)
#End If
'End If
End Function
2. Open TabTip
Code:
Public Function OpenTabTip()
''=====================================================
'Colin Riddington - Mendip Data Systems
'18/09/2018
'opens tablet screen keyboard in tablet mode
'To test it on a standard PC, disable the 'If ...End If
'If modMetrics.System(SM_TABLETPC) Then
#If Win64 Then
ShellEx "C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe", , True
#Else
Call Wow64DisableWow64FsRedirection(lngPtr)
ShellEx "C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe", , True
Call Wow64RevertWow64FsRedirection(lngPtr)
#End If
'End If
End Function