none
Open On Screen Keyboard in Windows 10 via VBA RRS feed

  • Question

  • Access 2013 32bit application running Windows 10 Pro on a touch device (laptop or touchpad).

    As we all know, the on screen keyboard does not open when tapping a textbox in Access.

    In Windows 8, the workaround was a shell call to osk.exe, and the on screen keyboard would open.

    However, that no longer works in Windows 10. Instead there is a message 'Could not start On-Screen keyboard'
    The message is not a vba error, it is from the exe.

    I have tried:
    apiShellExecute 0, vbNullString, "osk.exe", vbNullString, "C:\Windows\System32", 1
    results in above error.

    Shell "C:\Windows\System32\osk.exe", 1
    results in vba error 'Invalid Procedure call'

    Create bat file to open osk.exe and call the bat file via shell or ShellExecute
    Same results as above

    Create Shortcut to open osk.exe and call the shortcut via shell or ShellExecute
    Same results as above

    Same results using C:\Windows\SysWOW64\osk.exe

    Opening osk.exe DOES work directly from the command line, Windows run box, Windows Explorer, bat file or shortcut.

    I have googled for hours and not found anything else.

    Anyone have any other ideas how to open the on screen keyboard via VBA?


    • Edited by Alphonse G Monday, August 21, 2017 7:34 PM
    Friday, July 14, 2017 12:29 PM

Answers

  • Here is the solution arrived at from my Microsoft support case.
    There are two methods.
    The first is just using ShellExecuteEx and worked fine on my Laptop.

       Public Enum ShellExMask
          SEE_MASK_DEFAULT = &H0
          SEE_MASK_CLASSNAME = &H1
          SEE_MASK_CLASSKEY = &H3
          SEE_MASK_IDLIST = &H4
          SEE_MASK_INVOKEIDLIST = &HC
          SEE_MASK_ICON = &H10
          SEE_MASK_HOTKEY = &H20
          SEE_MASK_NOCLOSEPROCESS = &H40
          SEE_MASK_CONNECTNETDRV = &H80
          SEE_MASK_NOASYNC = &H100
          SEE_MASK_DOENVSUBST = &H200
          SEE_MASK_FLAG_NO_UI = &H400
          SEE_MASK_UNICODE = &H4000
          SEE_MASK_NO_CONSOLE = &H8000
          SEE_MASK_ASYNCOK = &H100000
          SEE_MASK_HMONITOR = &H200000
          SEE_MASK_NOZONECHECKS = &H800000
          SEE_MASK_WAITFORINPUTIDLE = &H2000000
          SEE_MASK_FLAG_LOG_USAGE = &H4000000
          SEE_MASK_FLAG_HINST_IS_SITE = &H8000000
       End Enum
      
       Type SHELLEXECUTEINFO
          cbSize As Long
          fMask As Long
          hwnd As Long
          lpVerb As String
          lpFile As String
          lpParameters As String
          lpDirectory As String
          nShow As Long
          hInstApp As Long
          lpIDList As Long
          lpClass As String
          hkeyClass As Long
          dwHotKey As Long
          hIcon As Long
          hProcess As Long
       End Type
      
       Public Declare Function ShellExecuteEx Lib "shell32.dll" _
       (lpExecInfo As SHELLEXECUTEINFO) As Long

    Public Function KeyboardOpen()
      Dim shInfo As SHELLEXECUTEINFO

       With shInfo
          .cbSize = Len(shInfo)
          .lpFile = "C:\Windows\Sysnative\cmd.exe" 'best to use Known folders here
          .lpParameters = "/c start osk.exe"
          .lpDirectory = "C:\windows\system32" 'best to use Known folders here
          .lpVerb = "open"
          '.fMask = ShellExMask.SEE_MASK_INVOKEIDLIST 'or ShellExMask.SEE_MASK_NO_CONSOLE 'tried using masks, but they either had no effect or crashed Access
          .nShow = 0
       End With
       Call ShellExecuteEx(shInfo)
    End Function

    This, however, did not work on a Surface Pro (3 or 4).

    To work on a Surface, required 2 additional API's.

    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
    Declare Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean

    Call Wow64DisableWow64FsRedirection prior to calling ShellExecuteEx and Wow64RevertWow64FsRedirection, immediately after.

    Public Function KeyboardOpen()
      Dim shInfo As SHELLEXECUTEINFO
      Dim lngPtr As Long

       With shInfo
          .cbSize = Len(shInfo)
          .lpFile = "C:\Windows\Sysnative\cmd.exe" 'best to use Known folders here
          .lpParameters = "/c start osk.exe"
          .lpDirectory = "C:\windows\system32" 'best to use Known folders here
          .lpVerb = "open"
          .nShow = 0
       End With
       Call Wow64DisableWow64FsRedirection(lngPtr)
       Call ShellExecuteEx(shInfo)
       Call Wow64RevertWow64FsRedirection (lngPtr)
    End Function

    I hope this helps someone else.

    • Marked as answer by Alphonse G Monday, August 21, 2017 8:13 PM
    Monday, August 21, 2017 8:13 PM

All replies

  • Hi Alphonse G,

    I try to make a test with multiple code examples to check the issue.

    I find that I am getting the same as you.

    it looks like something has been changed in Windows 10.

    I find that there is no issue with the code and it can work correctly if you test it with other os.

    another you will notice that when it give you the error message , it will start the instance of on screen keyboard if you check it in the task manager.

    and when you close the error it will also close the on screen keyboard.

    I will try to discuss the issue with other engineers and try to know their opinion on this issue and inform you back.

    Regards

    Deepak 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 17, 2017 5:13 AM
    Moderator
  • Thanks Deepak. I hope they can come up with a solution.
    Monday, July 17, 2017 10:16 AM
  • I enlisted the help of the Access Dev team and they kindly provide the following information:"The issue is that the on-screen keyboard requires running with elevated privileges, and the Shell command can’t do that.

     

    You can use the Windows API ShellExecute like so:

     

    ShellExecute 0, "runas", "C:\windows\system32\osk.exe", "", "", SW_SHOWNORMAL

     

    The “runas” verb indicates that the program needs elevated privileges, and will trigger a UAC alert (assuming they aren’t being suppressed) to ask for confirmation.

     

    On windows 10, the default on-screen keyboard is tabtip.exe, rather than osk.exe:

     

    ShellExecute 0, "runas", "C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe", "", "", SW_SHOWNORMAL

     

    That might be helpful for some people."


    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Monday, July 17, 2017 7:59 PM
  • Thanks Daniel. Especially for getting a response so fast.

    Typical Microsoft. Makes no sense. Access won't open the keyboard itself, like other applications do, and they take away the ability for us to open it via any other method.

    I can imagine the feedback from clients, when they need to respond to UAC alert every time the keyboard needs to open.

    I tried using the "runas" parameter with osk.exe and yes, the UAC alert came up. Even though I clicked 'Yes', I still got the same error.

    Tabtip.exe doesn't seem right either, as osk.exe works from 'Search' or 'Run'.

    I did try ShellExecute 0, "runas", "C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe", "", "", SW_SHOWNORMAL.
    After confirming the UAC alert, nothing opens on screen. However, Task manager shows 'Touch Keyboard and Handwriting Panel' running.
    The same thing happens when trying to run it via 'Search' or 'Run'.

    Do they have any practical suggestion on how to use the keyboard with Access?

    Monday, July 17, 2017 8:48 PM
  • Hi Alphonse,

    Access was around before ubiquitous touch screens, so it wasn't added initially, and we try to prioritize appropriately when adding new functionality.  However, we recognize that touch is pretty common now, so we are looking at what we can do in this space, I was just trying to help out in the meantime.

    As far as taking away ways to launch the on-screen keyboard, that is something completely outside the scope of Access, and I don't think the Windows team set out to make things more difficult for anyone, but they may not have considered this the primary use case for the on screen keyboard (using it with older applications with no built-in support).

    I'm not sure why you are still getting the error after the UAC prompt.  Are you logged in as an Adminstrator?  If not, can you try that and see if it works in that case (I know this isn't a workaround, just trying to isolate the issue).
    I mentioned tabtip.exe because it is the keyboard that will come up when you use a touch-enabled app on Windows 10 (rather than osk.exe)

    Thanks for letting us know about the issue, and we'll let you know if we have any updates for you.

    Shane
    Microsoft


    Shane L. Groff (Microsoft Engineer)

    Monday, July 17, 2017 9:44 PM
  • Thank you for popping in Shane and giving us some of your valuable insight!

    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Tuesday, July 18, 2017 12:38 AM
  • Thanks for responding, Shane, I certainly appreciate your time - and taking the brunt of my frustration :).

    Access was around before ubiquitous touch screens, so it wasn't added initially, and we try to prioritize appropriately when adding new functionality.  However, we recognize that touch is pretty common now, so we are looking at what we can do in this space, I was just trying to help out in the meantime.

    Full touch capability would be awesome, however, I (as well as end users) do understand that it would be a major change. We would be happy (for now) with keyboard action. Datasheets actually respond quite well to swipe action.

    As far as taking away ways to launch the on-screen keyboard, that is something completely outside the scope of Access, and I don't think the Windows team set out to make things more difficult for anyone, but they may not have considered this the primary use case for the on screen keyboard (using it with older applications with no built-in support).

    I do understand that this is a Windows issue, I posted here because I'm working in Access and don't know of anywhere else to post where I'm likely to get a response from anyone connected to Microsoft.
    I'm sure no one set out to create the issue and the fault lies with Microsoft and not with the teams. IMHO, there is still not enough communication between the various teams. I was told this, flat out, several years ago during a support incident that involved Access/ODBC/SQL Server - which (BTW) has never been fixed.

    I'm not sure why you are still getting the error after the UAC prompt.  Are you logged in as an Adminstrator?  If not, can you try that and see if it works in that case (I know this isn't a workaround, just trying to isolate the issue).
    I mentioned tabtip.exe because it is the keyboard that will come up when you use a touch-enabled app on Windows 10 (rather than osk.exe)

    I have tried opening Access (2013) as administrator (on both a Surface Pro 3 and a laptop).
    Then, enabled the administrator account and logged on as administrator.

    In both cases I tried
    ShellExecute 0, "runas", "C:\windows\system32\osk.exe", "", "", SW_SHOWNORMAL
    UAC comes up, click yes, same error ('Could not start On-Screen keyboard').
    and
    ShellExecute 0, vbnullstring, "C:\windows\system32\osk.exe", "", "", SW_SHOWNORMAL
    No UAC, same error ('Could not start On-Screen keyboard').

    Thanks again, I do appreciate your assistance.

    • Edited by Alphonse G Tuesday, July 18, 2017 1:34 AM
    Tuesday, July 18, 2017 1:34 AM
  • Hi Alphonse G,

    we have make a test on our side.

    in Win10 1703 /  Office 15.0.4937.1000 64bit we are able to open the on screen keyboard.

    when we try to make the test on other machine which have OS version is 1607, we got same message.

    so if you are available with this version of windows 10 and Office then you can try to make a test on your side.

    I try to open tabtip.exe with the code below and it works on the same machine on which we are getting error to open the onscreen keyboard.

     

    Sub demo()
     Dim Apath As String
     Apath = "C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe"
     FollowHyperlink Apath
     End Sub

    you can try to make a test and let us know about the result.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 18, 2017 6:56 AM
    Moderator
  • Thanks Deepak,

    Like many, I have not yet upgraded to Windows Creators version. I am still running 1607.
    Also, I am using Office 2013 32 bit.
    32 bit is what Microsoft recommends and what most users have installed. Since both 32 and 64 bit versions cannot be installed on the same machine, it is totally not practical to uninstall 32 bit and install 64 bit.
    Are you able to test with Win10 1703 and Office 32bit?
    Upgrading to Win10 1703 would be acceptable as it will happen eventualy anyway.

    Running as Administrator, when using FollowHyperlink "C:\Program Files\Common Files\microsoft shared\ink\tabtip.exe", there is the security warning 'Some files can contain viruses...'. Click Ok and Task Manager shows it open as a background process. There is nothing on screen.

    Tuesday, July 18, 2017 11:55 AM
  • Can you confirm that you have the setting to automatically show the keyboard enabled as described here: http://www.thewindowsclub.com/make-windows-10-show-touch-keyboard-automatically ?


    Shane L. Groff (Microsoft Engineer)

    Tuesday, July 18, 2017 5:46 PM
  • Logged on as my normal user, yes.
    As administrator, was not, so set it and tried again - no change, whether keyboard connected or not.
    Tuesday, July 18, 2017 6:23 PM
  • Deepak,

    Have you been able to test with Win10 1703 and Office 32bit?

    Wednesday, July 26, 2017 12:08 PM
  • Hi Alphonse G,

    I try to check and find that on most of the machines there is virtual machine is installed which is not 1703.

    the machine I find that have 1703 is have other versions of Office installed.

    I will try to find the machine which have Win 10 1703 and Office 35 bit to make a test.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, July 27, 2017 3:20 AM
    Moderator
  • Thank you. Please do.
    Thursday, July 27, 2017 10:16 AM
  • I just got done with the forced 2 hour Creators update to Windows 10 on my Surface Pro.

    The issue remains.

    Friday, July 28, 2017 5:38 PM
  • Hi Alphonse G,

    I am not available with the exact version of Win10 and Office but I have Windows10 and Office 2016 32 bit.

    on which I made a test and I got permission related error.

     

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 31, 2017 3:25 AM
    Moderator
  • Thanks Deepak.

    Can anyone offer a solution to open the on screen keyboard via Access VBA?

    Monday, July 31, 2017 10:17 AM
  • Hi Alphonse G,

    further I try to create shortcut of osk.exe and place it on other location and try to access it from code but it gave a same message.

    I also try to open cmd from code and try to open osk.exe but same error message.

    Sub demo()
    Shell "cmd.exe \k osk", vbNormalFocus
     End Sub
    
    
    
    Sub dem()
    Shell "CMD /k C:\windows\system32\osk.exe"
    End Sub
     
    

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, August 1, 2017 1:42 AM
    Moderator
  • Thanks Deepak.

    I've opened a support incident with Microsoft today.

    I'll post back with the result.

    Tuesday, August 1, 2017 1:45 AM
  • Here is the solution arrived at from my Microsoft support case.
    There are two methods.
    The first is just using ShellExecuteEx and worked fine on my Laptop.

       Public Enum ShellExMask
          SEE_MASK_DEFAULT = &H0
          SEE_MASK_CLASSNAME = &H1
          SEE_MASK_CLASSKEY = &H3
          SEE_MASK_IDLIST = &H4
          SEE_MASK_INVOKEIDLIST = &HC
          SEE_MASK_ICON = &H10
          SEE_MASK_HOTKEY = &H20
          SEE_MASK_NOCLOSEPROCESS = &H40
          SEE_MASK_CONNECTNETDRV = &H80
          SEE_MASK_NOASYNC = &H100
          SEE_MASK_DOENVSUBST = &H200
          SEE_MASK_FLAG_NO_UI = &H400
          SEE_MASK_UNICODE = &H4000
          SEE_MASK_NO_CONSOLE = &H8000
          SEE_MASK_ASYNCOK = &H100000
          SEE_MASK_HMONITOR = &H200000
          SEE_MASK_NOZONECHECKS = &H800000
          SEE_MASK_WAITFORINPUTIDLE = &H2000000
          SEE_MASK_FLAG_LOG_USAGE = &H4000000
          SEE_MASK_FLAG_HINST_IS_SITE = &H8000000
       End Enum
      
       Type SHELLEXECUTEINFO
          cbSize As Long
          fMask As Long
          hwnd As Long
          lpVerb As String
          lpFile As String
          lpParameters As String
          lpDirectory As String
          nShow As Long
          hInstApp As Long
          lpIDList As Long
          lpClass As String
          hkeyClass As Long
          dwHotKey As Long
          hIcon As Long
          hProcess As Long
       End Type
      
       Public Declare Function ShellExecuteEx Lib "shell32.dll" _
       (lpExecInfo As SHELLEXECUTEINFO) As Long

    Public Function KeyboardOpen()
      Dim shInfo As SHELLEXECUTEINFO

       With shInfo
          .cbSize = Len(shInfo)
          .lpFile = "C:\Windows\Sysnative\cmd.exe" 'best to use Known folders here
          .lpParameters = "/c start osk.exe"
          .lpDirectory = "C:\windows\system32" 'best to use Known folders here
          .lpVerb = "open"
          '.fMask = ShellExMask.SEE_MASK_INVOKEIDLIST 'or ShellExMask.SEE_MASK_NO_CONSOLE 'tried using masks, but they either had no effect or crashed Access
          .nShow = 0
       End With
       Call ShellExecuteEx(shInfo)
    End Function

    This, however, did not work on a Surface Pro (3 or 4).

    To work on a Surface, required 2 additional API's.

    Declare Function Wow64DisableWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean
    Declare Function Wow64RevertWow64FsRedirection Lib "kernel32.dll" (ByRef ptr As Long) As Boolean

    Call Wow64DisableWow64FsRedirection prior to calling ShellExecuteEx and Wow64RevertWow64FsRedirection, immediately after.

    Public Function KeyboardOpen()
      Dim shInfo As SHELLEXECUTEINFO
      Dim lngPtr As Long

       With shInfo
          .cbSize = Len(shInfo)
          .lpFile = "C:\Windows\Sysnative\cmd.exe" 'best to use Known folders here
          .lpParameters = "/c start osk.exe"
          .lpDirectory = "C:\windows\system32" 'best to use Known folders here
          .lpVerb = "open"
          .nShow = 0
       End With
       Call Wow64DisableWow64FsRedirection(lngPtr)
       Call ShellExecuteEx(shInfo)
       Call Wow64RevertWow64FsRedirection (lngPtr)
    End Function

    I hope this helps someone else.

    • Marked as answer by Alphonse G Monday, August 21, 2017 8:13 PM
    Monday, August 21, 2017 8:13 PM
  • I use basically the same functions, but in a (for me as not expert) more readable way.

    It works under Windows 10 64, without elevated rights.

    Option Explicit
    Dim lngPtr As Long
    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

    'Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection, immediately after.
    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

    Private Function ShowKeyboard()

    Call Wow64DisableWow64FsRedirection(lngPtr)
    ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
    Call Wow64RevertWow64FsRedirection(lngPtr)

    End Function

    Private Function HideKeyboard()

    Call Wow64DisableWow64FsRedirection(lngPtr)
    ShellExecute 0, "open", "tskill", "osk", "", vbHidden
    Call Wow64RevertWow64FsRedirection(lngPtr)

    End Function







    • Edited by dorian.h Saturday, November 11, 2017 4:25 PM
    • Proposed as answer by dorian.h Saturday, November 11, 2017 4:42 PM
    Saturday, November 11, 2017 4:19 PM
  • I also have code to open an on screen keyboard in Access.
    I now use TabTip.exe but it also works with osk.exe

    The code has been used with no issues in Windows 10 with all the following:
    - A2010 32-bit on desktop
    - A2016 64-bit on laptop
    - A2010 32-bit on tablet

    Like those above, the code uses Shell execute and a Metrics module.
    However it's a bit simpler than some of the previous examples

    Normally its only enabled in tablet mode - detected using a call to a Metrics module

    ==============================================
    Public Sub OpenTabTip()
    'opens tablet screen keyboard if opened in tablet mode
    If modMetrics.System(SM_TABLETPC) Then
        ShellEx "C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe", , True  
    End If
    End Sub

    ==============================================

    Public Sub RunOSK()
    'opens on screen keyboard if opened in tablet mode
    If modMetrics.System(SM_TABLETPC) Then
        apiShellExecute 0, vbNullString, "osk.exe", vbNullString, "C:\", 1
    End If

    End Sub 

    ==============================================

    Public Sub ShellEx(ByVal Path As String, Optional ByVal Parameters As String, Optional ByVal HideWindow As Boolean) 'CR v5186

        If Dir(Path) > "" Then
            apiShellExecute 0, "open", Path, Parameters, "", IIf(HideWindow, 0, 1)
        Else
            MsgBox "Can't find program"
        End If

    End Sub


    ==============================================
    Related code from a Metric module similar to those listed above

    Public Function System(SystemMetricRequired As SystemConstants, Optional ConvertToTwips As Boolean = True) As Variant
    If ConvertToTwips Then
        Select Case SystemMetricRequired
            Case SM_CYSCREEN, SM_CYHSCROLL, SM_CYCAPTION, _
                    SM_CYBORDER, SM_CXDLGFRAME, SM_CYDLGFRAME, _
                    SM_CYVTHUMB, SM_CYICON, SM_CYCURSOR, _
                    SM_CYMENU, SM_CYFULLSCREEN, SM_CYKANJIWINDOW, _
                    SM_CYVSCROLL, SM_CYMIN, SM_CYSIZE, _
                    SM_CYFRAME, SM_CYMINTRACK, SM_CYDOUBLECLK, _
                    SM_CYICONSPACING, SM_CYSIZEFRAME, SM_CYFIXEDFRAME
                System = converttoTwipsY(apiGetSystemMetrics(SystemMetricRequired))
            Case Else: System = converttoTwipsX(apiGetSystemMetrics(SystemMetricRequired))
        End Select
    Else
        System = apiGetSystemMetrics(SystemMetricRequired)
    End If
    End Function

    Monday, November 13, 2017 8:54 PM
  • It sure helped me... I've spent too much time on this problem..

    I think my problem was kind of unique because I am using 32bit access 2016.

    I tried all the variations of "shellexecute" from Utter and stack but it wasn't until I tried your 2nd flavor with the wow64 references that it worked..

    thanks..

    sk

    Friday, February 22, 2019 10:16 PM
  •  

    i think your onscreen keyboard problem will be solve in this way

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

        Private Sub LinkLabel1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles LblOKS.MouseClick

            Dim osk As String = "C:\Windows\System32\osk.exe"

            Wow64DisableWow64FsRedirection(0)
            Process.Start(osk)

        End Sub

           
    Wednesday, October 23, 2019 12:29 PM
  • thanks this worked fine on Win 10 MS access 2013 

    we changed from Private to public function

    and it is available throughout the project. Hopefully it will help others

    Dim lngPtr As Long
    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

    'Call Wow64DisableWow64FsRedirection prior to calling ShellExecute and Wow64RevertWow64FsRedirection, immediately after.
    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
    Public Function ShowKeyboard()
    Call Wow64DisableWow64FsRedirection(lngPtr)
    ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
    Call Wow64RevertWow64FsRedirection(lngPtr)
    End Function

    Public Function HideKeyboard()
    Call Wow64DisableWow64FsRedirection(lngPtr)
    ShellExecute 0, "open", "tskill", "osk", "", vbHidden
    Call Wow64RevertWow64FsRedirection(lngPtr)
    End Function

    Wednesday, February 5, 2020 8:57 AM
  • There are actually two different on screen keyboards that can be loaded

    1. The older accessibility keyboard osk.exe

    2. The newer tablet keyboard(s) tabtip.exe

    I have a working example in this post at AWF On screen keyboard example

    The link includes the code used to load each keyboard from Access

    Friday, February 7, 2020 4:47 PM