Want to open TabTip.exe instead of osk.exe... (Windows 10 - Surface 2 Tablet - Excel 32 bit)

MistakesWereMade

Board Regular
Joined
May 22, 2019
Messages
103
I got osk.exe to open but would rather utilize TabTip.exe instead. Any ideas on how this may be achieved? My code for bringing up the osk.exe is shown below.

Code:
Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpszOp As String, ByVal lpszFile As String, ByVal lpszParams As String, ByVal LpszDir As String, ByVal FsShowCmd As Long) As Long
Private Declare PtrSafe Function Wow64EnableWow64FsRedirection Lib "kernel32.dll" (ByVal Enable As Boolean) As Boolean
Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Declare PtrSafe Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long
Private Declare PtrSafe Function GetCurrentProcess Lib "kernel32" () As Long
Private Declare PtrSafe Function IsWow64Process Lib "kernel32" (ByVal hProc As Long, bWow64Process As Long) As Long


Public Function Is64bit() As Long
   If GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process") > 0 Then
      IsWow64Process GetCurrentProcess(), Is64bit
   End If
End Function

Private Sub Label1_Click()


ComboBox1.SetFocus


If Is64bit Then
      Wow64EnableWow64FsRedirection False
      ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
      Wow64EnableWow64FsRedirection True
   Else
      ShellExecute 0, "open", "osk.exe", "", "", vbNormalFocus
   End If


End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I got osk.exe to open but would rather utilize TabTip.exe instead. Any ideas on how this may be achieved? My code for bringing up the osk.exe is shown below.

It is probably because the tabtip.exe is still open in memory .

Try closing it first as follows and see if it works : (changes in blue)
Code:
Private Sub Label1_Click()

    ComboBox1.SetFocus
    
    [COLOR=#0000ff]Const TARGET_APP_EXE As String = "TabTip.exe"[/COLOR]
    
    [COLOR=#0000ff]Call Terminate_App(TARGET_APP_EXE)[/COLOR]
    
    If Is64bit Then
        Wow64EnableWow64FsRedirection False
        ShellExecute 0, "open", [COLOR=#0000ff]TARGET_APP_EXE[/COLOR], "", "C:\windows\system32\TabTip.exe", vbNormalFocus
        Wow64EnableWow64FsRedirection True
    Else
        ShellExecute 0, "open", [COLOR=#0000ff]TARGET_APP_EXE[/COLOR], "", "", vbNormalFocus
    End If

End Sub


[COLOR=#0000ff]Private Sub Terminate_App(ByVal AppExe As String)
    Dim oWMI As Object, oProcs As Object, oProc As Object
    
    Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
    Set oProcs = oWMI.ExecQuery("select * from win32_process where name='" & AppExe & "'")
    For Each oProc In oProcs
        oProc.Terminate
    Next
End Sub[/COLOR]


Also, I think the first call to ShellExecute (when Is64bit is True) should be :
Code:
 ShellExecute 0, "open", TARGET_APP_EXE, "", "", vbNormalFocus
without specifying the LpszDir argument as in my windows 10, the tabtip.exe file (as opposed to osk.exe) is not located in the system32 folder.
 
Last edited:
Upvote 0
Unfortunately, the code would run without error but nothing would happen.

It worked for me but I am using excel 64 bit ... I don't have 32bit excel to test.

You are using excel 32 bit so I guess you should remove the "C:\windows\system32\TabTip.exe" and pass an empty string ""

Code:
If Is64bit Then
        Wow64EnableWow64FsRedirection False
        ShellExecute 0, "open", TARGET_APP_EXE, "", [COLOR=#ff0000][B]""[/B][/COLOR], vbNormalFocus
        Wow64EnableWow64FsRedirection True

[COLOR=#008000]' rest of code .........[/COLOR]
 
Upvote 0
Yeah, I still couldn't get it to work. However, I decided I actually prefer my osk.exe setup so I'll just stick with that! Thanks for all the help though Jaafar!
 
Upvote 0

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top