0

I am launching the touch keyboard in an administrator account from my application on a button press as follows :

 var progFiles = @"C:\Program Files\Common Files\Microsoft Shared\ink";
 var keyboardPath = Path.Combine(progFiles, "TabTip.exe");
 Process.Start(keyboardPath);

However from a non-admin account, the touch keyboard does not launch.

I have tried various techniques (using ShellExecuteEx, CreateProcessWithLogonW, impersonation etc) with no luck.

Is it possible to do this?

JD.
  • 15,171
  • 21
  • 86
  • 159
  • Is it WinForms, WPF, UWP ? – Tony Mar 24 '17 at 03:25
  • I guess the problem is that you don't have access to this directory. You could however copy the software into your app data folder (bin/debug or bin/release) – MetaColon Mar 24 '17 at 05:49
  • @Tony : WPF, worked fine on windows 8.1 for non admin account – JD. Mar 24 '17 at 16:20
  • Have you tried int oskID = System.Diagnostics.Process.Start( "osk" ).Id; And for close it: System.Diagnostics.Process.GetProcessById( oskID ).Kill(); – Tony Mar 24 '17 at 18:40

2 Answers2

6

After lots of tests, I found : Show touch keyboard (TabTip.exe) in Windows 10 Anniversary edition

So the issues is with a bug in windows 10 Anniversary edition.

From that link I used the C# code:

    var uiHostNoLaunch = new UIHostNoLaunch();
    var tipInvocation = (ITipInvocation)uiHostNoLaunch;
    tipInvocation.Toggle(GetDesktopWindow());
    Marshal.ReleaseComObject(uiHostNoLaunch);


   [ComImport, Guid("4ce576fa-83dc-4F88-951c-9d0782b4e376")]
   class UIHostNoLaunch
   {
   }

   [ComImport, Guid("37c994e7-432b-4834-a2f7-dce1f13b834b")]
   [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
   interface ITipInvocation
   {
       void Toggle(IntPtr hwnd);
   }

   [DllImport("user32.dll", SetLastError = false)]
   static extern IntPtr GetDesktopWindow();
Community
  • 1
  • 1
JD.
  • 15,171
  • 21
  • 86
  • 159
-1

"JD." said the answer to his question was "ITipInvocation.Toggle()". However, there are times in which this is not true.

In Win10 Ver 1803, DesktopMode, there is no reliable way to
toggle the "Touch Keyboard" on|off [ ITipInvocation.Toggle() ];
nor can you reliably discover if it's "up" ( on screen )
[ IFrameworkInputPane.Location() ]; both routines fail randomly.

Instead, ensure that "TabTIP.EXE" and "....InputApp.EXE"
only run when the keyboard is "up" ( on screen ); see:
https://stackoverflow.com/a/51376030/5732431

Jeff Relf
  • 55
  • 3
  • For future reference, just edit your original post. If there's any issues with undeleting it, raise a custom mod flag. –  Jul 31 '18 at 05:18
  • Now that I understand the extent to which robots operate here, I shouldn't have any (major) problems in the future, @Yvette. – Jeff Relf Aug 06 '18 at 20:40