Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Toggling "Touch Keyboard" On/Off, Firefox and Chrome.

505 views
Skip to first unread message

Jeff-Relf.Me

unread,
Jul 10, 2018, 4:53:17 PM7/10/18
to
Previously, I wrote:
> I love my ArmMounted, 40 inch, 4k, curved monitor, at arm's length,
> in bed; but, with no real desk or touch screen,
> hardware keyboards are a major pain in the ass.
>
> So I was thrilled by the "Touch Keyboard" recently introduced
> to the Windows 10, MouseOnly DesktopMode;
> what's more, it lets me (voice) dictate text.
>
> Now, "Jeff-Relf.Me/X.HTM" supports these SystemWide "HotKeys"
> ( assigned to g600 mouse buttons, Jeff-Relf.Me/g600.PNG ):
>
> Alt+Shift+Ctrl+K: Toggles "Touch Keyboard" On/Off.
> Alt+Shift+Ctrl+M: Toggles Monitor On/Off(asleep).

Compared to other apps, Firefox and Chrome are very picky
about how they interact with the Touch Keyboard;
so " Show Touch Keyboard button ", in SysTray, Must be Enabled.

"Randomly", the keyboard is slow to come up; I'm working on it.

HWND Win, TaskBar, SysTray, Keyboard ; MSG Msg ;
...
TaskBar = FindWindow( L"Shell_TrayWnd", 0 );
SysTray = FindWindowEx( TaskBar, 0, L"TrayNotifyWnd", 0 );
Keyboard = FindWindowEx( SysTray, 0, L"TIPBand", 0 );
....
RegisterHotKey(
Win, 'K', MOD_CONTROL | MOD_ALT | MOD_SHIFT | MOD_NOREPEAT, 'K' );
....
if ( Msg.message == WM_HOTKEY && Msg.wParam == 'K' )
Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" ),
PostMessage( Keyboard, WM_LBUTTONDOWN, 0, 0 ),
PostMessage( Keyboard, WM_LBUTTONUP, 0, 0 );

%

unread,
Jul 10, 2018, 4:56:57 PM7/10/18
to
wait until you see what a real computer can do

Jeff-Relf.Me

unread,
Jul 13, 2018, 4:47:17 AM7/13/18
to
Previously, I wrote:
> Alt+Shift+Ctrl+K: Toggles "Touch Keyboard" On/Off.
> "Randomly", the keyboard is slow to come up; I'm working on it.

The fix was to ReKill Cortana.
Windows Update brings Cortana back from the dead, as a zombie;
Zombie Cortana then randomly blocks "Touch Keyboard".

Find the Cortana process in the TaskManager -> "Open File Location".
ReTake, ReGain ownership of the Cortana folder.

Try to rename the folder [ a prompt will come up ];
kill Cortana so you can _Quickly_ hit "Try again",
thus renaming it before Cortana returns from the dead.

Copy Over a TextFile and give it the same name as the Cortana folder,
so (hopefully) the folder won't get ReCreated.

Merge the following into the registry and ReBoot:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Windows Search]
"AllowCortana"=dword:0

Jeff-Relf.Me

unread,
Jul 16, 2018, 1:10:01 AM7/16/18
to
"Storage_Unit" [sic] replied to me :
> > if ( Msg.message == WM_HOTKEY && Msg.wParam == 'K' )
> > Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" ),
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Things like that are the reason why Windows programs suddenly break
> when something is not installed to default location.

Amen to that, it's a _damn_serious_ problem.
My code, on the other hand, affects no one but me.

> By the way, Jeff, why no HTML posts anymore?

<PRE> is thee _only_ way to post a "table" (report);
otherwise, it won't display properly on Google Groups.
As I get older, I give fewer and fewer fucks.

Jeff-Relf.Me

unread,
Jul 16, 2018, 9:05:15 AM7/16/18
to
> > > if ( Msg.message == WM_HOTKEY && Msg.wParam == 'K' )
> > >   Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" ),

The "random delay" thing is still happening; my latest attempt:

  if ( WM == WM_HOTKEY && C == 'K' ) {
    int  Cnt = 1 ;   static double  Mark ;   HWND  Keyboard ;
    ITipInvocation  * VirKeyboard ;

    //  Alt+Shift+Ctrl+K: Toggles "Touch Keyboard" On/Off. 
    //     If the keyboard doesn't come up right away, 
    //     toggle 3 times in less than 3 seconds.

    !Mark || Secs > Mark + 3 ? Mark = Secs, Cnt = 1 : ++Cnt > 3 
      ? Mark = Secs, Cnt = 1, 
          Keyboard = FindWindow( 0, L"Microsoft Text Input Application" ),
          Keyboard ? SendMessage(  Keyboard, WM_SYSCOMMAND, SC_CLOSE, 0 ) : 0,
          Launch(  L"/Windows/SystemApps/InputApp_cw5n1h2txyewy/"
            L"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE"
          ) : 0 ;

    if ( CoCreateInstance( CLSID_UIHostNoLaunch, 0, 
           CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER, 
           IID_ITipInvocation, (void**)&VirKeyboard ) )

          Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" );

    else VirKeyboard->Toggle( GetDesktopWindow() ), VirKeyboard->Release();  }

Jeff-Relf.Me

unread,
Jul 16, 2018, 9:13:04 AM7/16/18
to
Correction...

The "random delay" thing is still happening; my latest attempt:

#include <InitGuid.H>

typedef LARGE_INTEGER DubInt ; unsigned __int64 u64 ;
u64 _Tics, Hz ; double _Secs, _Hz ;

#define Tics ( QueryPerformanceCounter( ( DubInt * ) & _Tics ), _Tics )
#define Secs ( _Secs = Tics / _Hz )

QueryPerformanceFrequency( ( DubInt * ) & Hz ), _Hz = Hz ;

DEFINE_GUID( CLSID_UIHostNoLaunch, // 4ce576fa-83dc-4F88-951c-9d0782b4e376
0x4CE576FA, 0x83DC, 0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76);

DEFINE_GUID( IID_ITipInvocation, // 37c994e7_432b_4834_a2f7_dce1f13b834b
0x37c994e7, 0x432b, 0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b);

struct ITipInvocation : IUnknown {
virtual HRESULT STDMETHODCALLTYPE Toggle(HWND wnd) = 0; };

if ( WM == WM_HOTKEY && C == 'K' ) {
int Cnt = 1 ; static double Mark ; HWND Keyboard ;
ITipInvocation * VirKeyboard ;

// Alt+Shift+Ctrl+K: Toggles "Touch Keyboard" On/Off.
// If the keyboard doesn't come up right away,
// toggle 3 times in less than 3 seconds.

!Mark || Secs > Mark + 3 ? Mark = Secs, Cnt = 1 : ++Cnt > 3
? Mark = Secs, Cnt = 1,
Keyboard = FindWindow( 0, L"Microsoft Text Input Application" ),
Keyboard ? SendMessage( Keyboard, WM_SYSCOMMAND, SC_CLOSE, 0 ) : 0,
Launch( L"/Windows/SystemApps/InputApp_cw5n1h2txyewy/"
L"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE"
) : 0 ;

if ( CoCreateInstance( CLSID_UIHostNoLaunch, 0,
CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER,
IID_ITipInvocation, (void**)&VirKeyboard ) )

Paul

unread,
Jul 16, 2018, 9:38:37 AM7/16/18
to

bol...@cylonhq.com

unread,
Jul 16, 2018, 9:47:45 AM7/16/18
to
On Mon, 16 Jul 2018 06:12:54 -0700 (Seattle)
Jeff-Relf.Me @. wrote:
> !Mark || Secs > Mark + 3 ? Mark = Secs, Cnt = 1 : ++Cnt > 3
> ? Mark = Secs, Cnt = 1,
> Keyboard = FindWindow( 0, L"Microsoft Text Input Application" ),
> Keyboard ? SendMessage( Keyboard, WM_SYSCOMMAND, SC_CLOSE, 0 ) : 0,
> Launch( L"/Windows/SystemApps/InputApp_cw5n1h2txyewy/"

Wow, lazy evaluation instead of a proper if() and nested ? operators with comma
seperated multiple statements. And I thought Alfs code was an unmaintainable
mess but he has nothing on this guy.

Jeff-Relf.Me

unread,
Jul 16, 2018, 12:03:02 PM7/16/18
to
Yet another Correction...  see "TerminateProcess( aProc, 9 )".
From "Jeff-Relf.Me/X.CPP" in "Jeff-Relf.Me/X.ZIP".

#include <InitGuid.H>
#include <tlhelp32.H>

typedef LARGE_INTEGER  DubInt ;  unsigned __int64  u64 ;
u64  _Tics, Hz ;  double _Secs, _Hz ;

#define  Tics ( QueryPerformanceCounter( ( DubInt * ) & _Tics ), _Tics )
#define  Secs ( _Secs = Tics / _Hz )
      ......
QueryPerformanceFrequency( ( DubInt * ) & Hz ), _Hz = Hz ;
      ......
DEFINE_GUID( CLSID_UIHostNoLaunch,  //  4ce576fa-83dc-4F88-951c-9d0782b4e376 
  0x4CE576FA, 0x83DC, 0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76);

DEFINE_GUID( IID_ITipInvocation,  //  37c994e7_432b_4834_a2f7_dce1f13b834b 
  0x37c994e7, 0x432b, 0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b);

struct ITipInvocation : IUnknown {  
  virtual HRESULT STDMETHODCALLTYPE Toggle(HWND wnd) = 0;  };
    .....
if ( WM == WM_HOTKEY && C == 'K' ) {
  static  int Cnt ;   static double  Mark ;  ITipInvocation  * VirKeyboard ;
 HANDLE  PIDs, aProc ;  PROCESSENTRY32  aPID;

  //  Alt+Shift+Ctrl+K: Toggles "Touch Keyboard" On/Off. 
  //     If the keyboard doesn't come up right away, 
  //     toggle 3 times in less than 3 seconds.

  if ( !Mark || Secs > Mark + 3 ? Cnt = 0, Mark = Secs : 0, ++Cnt > 3 ) {

    PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 ); 
    aPID.dwSize = sizeof( PROCESSENTRY32 ), Process32First( PIDs, &aPID );
    NextProc:
      if (  Eqi( aPID.szExeFile, 
      L"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE" ) )

         aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ),
         aProc ? TerminateProcess( aProc, 9 ), CloseHandle(aProc) : 0,
         Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" );

      if ( Process32Next( PIDs, &aPID ) ) goto NextProc ;

    CloseHandle( PIDs );   }

  if ( CoCreateInstance( CLSID_UIHostNoLaunch, 0, 
         CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER, 
         IID_ITipInvocation, (void**)&VirKeyboard ) )

        Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" );

  else VirKeyboard->Toggle( GetDesktopWindow() ), VirKeyboard->Release();  }

Lewis

unread,
Jul 16, 2018, 12:05:49 PM7/16/18
to
In message <0eet1f-...@news.neodome.net> Storage Unit <storag...@mailinator.com> wrote:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Things like that are the reason why Windows programs suddenly break when
> something is not installed to default location.

Are you even able to install microsoft crap in a custom location?

Microsoft has been reliant on hard-coded paths since before Windows,
and Windows 10 is no different.

--
'Winners never talk about glorious victories. That's because they're the
ones who see what the battlefield looks like afterwards. It's only the
losers who have glorious victories.' --Small Gods

Paavo Helde

unread,
Jul 16, 2018, 12:31:47 PM7/16/18
to
There are lots of computers where there is no C:\Program Files, but for
example C:\Programme or C:\Archivos de programa.

Not to speak about missing C: in the original example, the code would
fail every time the current drive happens to be not C:.

There are Windows SDK functions for figuring out the locations of such
folders, but apparently if the program happened to work once somewhere
it's not broken.


Jeff-Relf.Me

unread,
Jul 16, 2018, 1:04:26 PM7/16/18
to
Paul wrote:
> > The "Touch Keyboard" doesn't always come up Right away.
>
> So you're one of these people then...
> stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition

Exactly. When the "Touch Keyboard" doesn't come up Right away:

Kill( "WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE" ).
Launch( "TabTip.EXE" ).

My "Touch Keyboard" toggle is tied to a mouse button;
DoubleClicking it does the ReStart.

See "PROCESS_TERMINATE" in "Jeff-Relf.Me/X.CPP" in "Jeff-Relf.Me/X.ZIP".

Jeff-Relf.Me

unread,
Jul 16, 2018, 1:15:15 PM7/16/18
to
> > > Launch( L"/Program Files/Common Files/microsoft shared/ink/TabTip.EXE" ),
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Things like that are the reason why Windows programs suddenly break when
> > something is not installed to default location.
>
> Are you even able to install microsoft crap in a custom location?
>
> Microsoft has been reliant on hard-coded paths since before Windows,
> and Windows 10 is no different.

I've been doing the following for many years now [ Jeff-Relf.Me/Win10.REG ]:

; Remove "Desktop, Documents, Downloads, Music, Pictures, Videos" folders From "This PC".
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A8CDFF1C-4878-43be-B5FD-F8091C1C60D0}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{d3162b92-9365-467a-956b-92703aca08af}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{374DE290-123F-4565-9164-39C4925E467B}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{088e3905-0323-4b02-9826-5d99428e115f}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{1CF1260C-4DD0-4ebb-811F-33C572699FDE}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3dfdf296-dbec-4fb4-81d1-6a3438bcf4de}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{3ADD1653-EB32-4cb0-BBD7-DFA0ABB5ACCA}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{A0953C92-50DC-43bf-BE83-3742FED03C9C}]
[-HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{f86fa3ab-70d2-4fc7-9c99-fcbf05467f3a}]

; SystemWide Environment Variables:
; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
; "TMP"="%SystemRoot%\\Tmp"
; Reqires a ReBoot.
[HKEY_CURRENT_USER\Environment]
"TMP"="C:\\__\\Tmp"
"TEMP"="C:\\__\\Tmp"
; Telnet.EXE, Zip.EXE, UnZip.EXE, 7z.EXE, nirCmd.EXE, Brc.EXE, pcre.DLL, ffmPeg.EXE
"Path"="C:\\__\\EXEs\\Shell"

; Switch SysFolders to Short, Friendly Paths, all under "C:\__" ( Home ).
;
; First, "RightClick Properties -> Location -> Move" each special folder.
; Make Sure "MyDocumentsLocation", "Shell Folders"/"Personal",
; and "User Shell Folders"/"Personal" ( below ) agree with each other.

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\15.0]
"MyDocumentsLocation"="C:\\__\\Sys"
"VisualStudioLocation"="C:\\__\\Sys\\AppData\\Microsoft\\VisStudio"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders]
"Personal"="C:\\__\\Sys"
"{374DE290-123F-4565-9164-39C4925E467B}"="c:\\__\\Sys"
"Startup"="C:\\__\\Startup"
"SendTo"="C:\\__\\SendTo"
"AppData"="c:\\__\\Sys\\AppData"
"Local AppData"="C:\\__\\Sys\\AppData"
"Local Settings"="C:\\__\\Sys"
"Local AppDataLow"="C:\\__\\Sys\\AppData\\LocalLow"
"Cache"="C:\\__\\Sys\\AppData\\IE-Tmp"
"Desktop"="C:\\__\\Sys\\AppData\\Desktop"
"PrintHood"="C:\\__\\Sys\\AppData\\PrintHood"
"NetHood"="C:\\__\\Sys\\AppData\\NetHood"
"Cookies"="C:\\__\\Sys\\AppData\\Cookies"
"Recent"="C:\\__\\Sys\\AppData\\Recent"
"Start Menu"="C:\\__\\Sys\\AppData\\Start Menu"
"Programs"="C:\\__\\Sys\\AppData\\Programs"
"History"="C:\\__\\Sys\\AppData\\History"
"Templates"="C:\\__\\Sys\\AppData\\Templates"
"Favorites"="C:\\__\\Sys\\AppData\\-Crap-"
"My Pictures"="C:\\__\\Sys\\AppData\\-Crap-"
"My Music"="C:\\__\\Sys\\AppData\\-Crap-"
"My Video"="C:\\__\\Sys\\AppData\\-Crap-"
"{A520A1A4-1780-4FF6-BD18-167343C5AF16}"="C:\\__\\Sys\\AppData\\LocalLow"

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Personal"="C:\\__\\Sys"
"{374DE290-123F-4565-9164-39C4925E467B}"="c:\\__\\Sys"
"Startup"="C:\\__\\Startup"
"SendTo"="C:\\__\\SendTo"
"AppData"="c:\\__\\Sys\\AppData"
"Local AppData"="C:\\__\\Sys\\AppData"
"Local Settings"="C:\\__\\Sys"
"Local AppDataLow"="C:\\__\\Sys\\AppData\\LocalLow"
"Cache"="C:\\__\\Sys\\AppData\\IE-Tmp"
"Desktop"="C:\\__\\Sys\\AppData\\Desktop"
"PrintHood"="C:\\__\\Sys\\AppData\\PrintHood"
"NetHood"="C:\\__\\Sys\\AppData\\NetHood"
"Cookies"="C:\\__\\Sys\\AppData\\Cookies"
"Recent"="C:\\__\\Sys\\AppData\\Recent"
"Start Menu"="C:\\__\\Sys\\AppData\\Start Menu"
"Programs"="C:\\__\\Sys\\AppData\\Programs"
"History"="C:\\__\\Sys\\AppData\\History"
"Templates"="C:\\__\\Sys\\AppData\\Templates"
"Favorites"="C:\\__\\Sys\\AppData\\-Crap-"
"My Pictures"="C:\\__\\Sys\\AppData\\-Crap-"
"My Music"="C:\\__\\Sys\\AppData\\-Crap-"
"My Video"="C:\\__\\Sys\\AppData\\-Crap-"
"{A520A1A4-1780-4FF6-BD18-167343C5AF16}"="C:\\__\\Sys\\AppData\\LocalLow"

Jeff-Relf.Me

unread,
Jul 17, 2018, 4:15:06 AM7/17/18
to
As it turns out...
The best way to toggle the Touch Keyboard,
is to "Kill/ReStart" it each time.

"KB->Toggle()" still has to be called, as Firefox and Chrome need it.

From "X.CPP" in "Jeff-Relf.Me/X.ZIP".

if ( WM == WM_HOTKEY && C == 'K' ) {  //  A mouse button takes me here.
 
  HANDLE  PIDs, aProc ;  PROCESSENTRY32  aPID;   ITipInvocation  * KB = 0 ;

  PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
  aPID.dwSize = sizeof( PROCESSENTRY32 ), Process32First( PIDs, &aPID );

  NextProc:
    if (  Eqi( aPID.szExeFile, L"TabTip.EXE" ) ) {

      if ( aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ) )

        TerminateProcess( aProc, 9 ), CloseHandle( aProc );

      goto  ReStart ;  }

  if ( Process32Next( PIDs, &aPID ) ) goto NextProc ;

  ReStart:    CloseHandle( PIDs );
  Launch( L"%CommonProgramW6432%/microsoft shared/ink/TabTip.EXE" );

  LoopJ(9) if ( CoCreateInstance( CLSID_UIHostNoLaunch, 0,
    CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**)&KB ), !KB )
      Sleep(99); else { KB->Toggle( GetDesktopWindow() ), KB->Release();  break ;  } }

    .....
#include <InitGuid.H>
#include <tlhelp32.H>

DEFINE_GUID( CLSID_UIHostNoLaunch,  //  4ce576fa-83dc-4F88-951c-9d0782b4e376 
  0x4CE576FA, 0x83DC, 0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76);

DEFINE_GUID( IID_ITipInvocation,  //  37c994e7_432b_4834_a2f7_dce1f13b834b 
  0x37c994e7, 0x432b, 0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b);

struct ITipInvocation : IUnknown {  
  virtual HRESULT STDMETHODCALLTYPE Toggle(HWND wnd) = 0;  };

#define  Eqi  !strCmpI
#define  LoopJ( N )  int  J = -1,  eJ = ( N ) - 1 ; while ( ++J  <= eJ  )

void Launch( LnP Cmd ) {  int Err, rv ;  
  wchar  _Cmd[333];  ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;

  static PROCESS_INFORMATION Stat ;    static STARTUPINFO SU = { sizeof SU };
  SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
  rv = CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ), CD( LocDir );
  if ( !rv ) { 
     Err = GetLastError(), *_B_Sh = 0 ; 
     FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, Err, 0, _B_Sh, 999, 0 );
     Sh( L"Error: %d, %s\n\n  <%s> wasn't launched", Err, _B_Sh, Cmd );
     return;  }

  CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread );  }

bol...@cylonhq.com

unread,
Jul 17, 2018, 5:03:50 AM7/17/18
to
On Mon, 16 Jul 2018 19:31:37 +0300
Paavo Helde <myfir...@osa.pri.ee> wrote:
>On 16.07.2018 19:05, Lewis wrote:
>> In message <0eet1f-...@news.neodome.net> Storage Unit
><storag...@mailinator.com> wrote:
>>> Jeff-Relf.Me @. writes:
>>>> Launch( L"/Program Files/Common Files/microsoft
>shared/ink/TabTip.EXE" ),
>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> Things like that are the reason why Windows programs suddenly break when
>>> something is not installed to default location.
>>
>> Are you even able to install microsoft crap in a custom location?
>>
>> Microsoft has been reliant on hard-coded paths since before Windows,
>> and Windows 10 is no different.
>
>There are lots of computers where there is no C:\Program Files, but for
>example C:\Programme or C:\Archivos de programa.

Thats just fuckwittery on the part of Microsoft. You wouldn't go into a
unix install in france or spain and expect to see /maison or /casa instead of
/home. Major OS paths should be standardised no matter what the locale.

SilverSlimer

unread,
Jul 17, 2018, 7:51:04 AM7/17/18
to
Completely agreed. It should be possible for a user who installed a
system in English to switch it over to something like Spanish and have
all of the software translate as well without any negative consequences.
I'm not sure whether Linux allows it to consistently change on demand (I
doubt it) but Windows should have made it possible considering they
charge for the operating system.

Paavo Helde

unread,
Jul 17, 2018, 8:36:35 AM7/17/18
to
Agreed, but unfortunately this does not change the reality.

Paavo Helde

unread,
Jul 17, 2018, 8:41:22 AM7/17/18
to
Yes, that's exactly the idea. All programs are supposed to call the
SHGetKnownFolderPath() Windows SDK function to find out the current name
of such folders, so that they could continue to work after such switch.


Snit

unread,
Jul 17, 2018, 11:41:20 AM7/17/18
to
If you move an app it should keep working.

--
Personal attacks from those who troll show their own insecurity. They
cannot use reason to show the message to be wrong so they try to feel
somehow superior by attacking the messenger.

They cling to their attacks and ignore the message time and time again.

<https://youtu.be/H4NW-Cqh308>

Jeff-Relf.Me

unread,
Jul 17, 2018, 11:40:26 PM7/17/18
to
Hopefully, I got it right this time ( only time will tell ).
stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition

To toggle the Touch Keyboard, and not have it randomly stall,
Kill "TabTip.EXE" -and- 
"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE"
each time ( each toggle ).

If both were running, then the keyboard _was_ up ( now down, killed );
otherwise, ReLaunch them, and run "KB->Toggle()" ( for Firefox&Chrome ).

From "X.CPP" in "Jeff-Relf.Me/X.ZIP".   

if ( WM == WM_HOTKEY && C == 'K' ) {  //  A mouse button takes me here.
  ITipInvocation  * KB = 0 ;          //  Jeff-Relf.Me/g600.PNG

  if ( Kill( L"TabTip.EXE" ) + Kill( L"WindowsInternal.ComposableShell"
         L".Experiences.TextInput.InputApp.EXE" ) < 2 ) {

      Launch(  L"%WinDir%/SystemApps/InputApp_cw5n1h2txyewy/"
               L"WindowsInternal.ComposableShell.Experiences."
               L"TextInput.InputApp.EXE" );

      Launch(  L"%CommonProgramW6432%/microsoft shared/ink/TabTip.EXE" );

      LoopJ(9)
        if ( CoCreateInstance(
               CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER
             | CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**)&KB ), !KB )

          Sleep(99); else {
            KB->Toggle( GetDesktopWindow() ), KB->Release();  break ;  } } }

    .....
#include <InitGuid.H>
#include <tlhelp32.H>

DEFINE_GUID( CLSID_UIHostNoLaunch,  //  4ce576fa-83dc-4F88-951c-9d0782b4e376 
  0x4CE576FA, 0x83DC, 0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76);

DEFINE_GUID( IID_ITipInvocation,  //  37c994e7_432b_4834_a2f7_dce1f13b834b 
  0x37c994e7, 0x432b, 0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b);

struct ITipInvocation : IUnknown {  
  virtual HRESULT STDMETHODCALLTYPE Toggle(HWND wnd) = 0;  };

#define  Eqi  !strCmpI
#define  LoopJ( N )  int  J = -1,  eJ = ( N ) - 1 ; while ( ++J  <= eJ  )

int Kill( LnP EXE ) { HANDLE  PIDs, aProc = 0 ;  PROCESSENTRY32  aPID;
  PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
  aPID.dwSize = sizeof( PROCESSENTRY32 ), Process32First( PIDs, &aPID );
  NextProc:
    if (  Eqi( aPID.szExeFile, EXE ) ) {
      if ( aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ) )
        TerminateProcess( aProc, 9 ), CloseHandle( aProc );  goto  Close ;  }

  if ( Process32Next( PIDs, &aPID ) ) goto NextProc ;
  Close:    CloseHandle( PIDs );  return !!aProc ;    }

void Launch( LnP Cmd ) {  int Err, rv ;  
  wchar  _Cmd[333];  ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;

  static PROCESS_INFORMATION Stat ;    static STARTUPINFO SU = { sizeof SU };
  SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
  rv = CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ), CD( LocDir );
  if ( !rv ) { 
     Err = GetLastError(), *_B_Sh = 0 ; 
     FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, Err, 0, _B_Sh, 999, 0 );
     Sh( L"Error: %d, %s\n\n  <%s> wasn't launched", Err, _B_Sh, Cmd );
     return;  }

  CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread );  }

%

unread,
Jul 18, 2018, 9:23:22 AM7/18/18
to
On 2018-07-17 3:32 AM, Storage Unit wrote:
> It's been many years, but if I remember correctly many system folders
> are called differently in different versions of Windows (French,
> Japanese, Chinese, etc.) because their names are translated to native
> language of the user. For example, I'm 100% sure that Desktop and
> Documents folders' names are always translated. I guess Desktop is not
> that important, but Documents folder is the default place where many
> programs keep their files, which mean that they try to access it at the
> startup.
>
> Even programs that allow custom paths to folders are often break when
> those paths contain non-ASCII characters.
>
>> Microsoft has been reliant on hard-coded paths since before Windows,
>> and Windows 10 is no different.
>
then why aren't you using 10

Jeff-Relf.Me

unread,
Jul 21, 2018, 5:32:48 AM7/21/18
to
Another fail, another post... 
stackoverflow.com/questions/50623154/c-sharp-wpf-windows-10-1803-touchkeyboard-unreliable-issue-prism-clickonce

I wrote an app that toggles the "Touch Keyboard" on and off 
at the hit of a mouse button ( Jeff-Relf.Me/g600.PNG ).

Occasionally, it doesn't work for a minute ( Win10 Ver 1803 ).
I think I'm confusing it, somehow,
as it wasn't designed for heavy mouse users like me.

Killing "...TextInput.InputApp.EXE" makes it work again;  
apparently, it's more "Modern/Metro" than Windows desktop.

Now, my ( poorly tested ) KeyboardToggle will:

  - Use "IFrameworkInputPane.Location()" to determine if
    the keyboard toggle hasn't worked, last 3 times; 
    if so, kill "...TextInput.InputApp.EXE". 

  - Ensure that "TabTip.EXE" is running; 
    launch it as many times as it takes, Zero or more times,
    until it shows up in the process list. 

  - Use "ITipInvocation.Toggle()" to toggle the keyboard.

From "X.CPP" in " Jeff-Relf.Me/X.ZIP ":   

  if ( WM == WM_HOTKEY && C == 'K' ) {  //  A mouse button takes me here.

    static int  FailCnt ;  static int  PrevUp = -1 ;   u64  *u ;
    int Up = -2 ;  RECT  _Up ;  IFrameworkInputPane  *kb = 0 ;

    //  - Use "IFrameworkInputPane.Location()" to determine if
    //    the keyboard toggle hasn't worked, last 3 times; 
    //    if so, kill "...TextInput.InputApp.EXE". 

    CoCreateInstance( CLSID_FrameworkInputPane, 0,
       CLSCTX_INPROC_SERVER, IID_IFrameworkInputPane, (void**) &kb);

    kb ? kb->Location( &_Up ), u = (u64*) &_Up,
      Up = !!( *u + u[1] ), kb->Release() : 0 ;

    if ( Up == PrevUp ? FailCnt++ : FailCnt = 0, PrevUp = Up, FailCnt >= 3 )  
      FailCnt = 0, KillProc = 1, Running( L"WindowsInternal.ComposableShell"
         L".Experiences.TextInput.InputApp.EXE" );

    //  - Ensure that "TabTip.EXE" is running; 
    //    launch it as many times as it takes, Zero or more times,
    //    until it shows up in the process list. 

    Verify = 1, Launch(  
       L"%CommonProgramW6432%/microsoft shared/ink/TabTip.EXE" );

    //  - Use "ITipInvocation.Toggle()" to toggle the keyboard.

    static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC, 0x4f88,
       0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
    static const GUID IID_ITipInvocation   = { 0x37c994e7, 0x432b, 0x4834,
       0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
    struct ITipInvocation : IUnknown {  virtual HRESULT STDMETHODCALLTYPE
       Toggle( HWND wnd ) = 0;  }  * KB = 0 ;
    CoCreateInstance( CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER |
       CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**) & KB );

    //  Firefox and Chrome require this:
    KB ? KB->Toggle( GetDesktopWindow() ), KB->Release() : 0 ;    }
      .....
  //  Poorly documented, "NTDDI_WIN10" is _vital_:
  #define  NTDDI_VERSION  NTDDI_WIN10

  //  To get the process list, and kill stuff: 
  #include <tlhelp32.H>

  //  To know if the keyboard is up or not: 
  #include <ShObjIdl.H>
    
  #define  Eqi  !strCmpI
  #define  FromEnd  wcsrchr
  typedef wchar  *LnP ;
  typedef unsigned __int64  u64 ;

  int  KillProc ;

  int Running( LnP EXE ) {  int  Found ;

    HANDLE  PIDs, aProc ;  PROCESSENTRY32  aPID = { sizeof aPID };
    PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
    Process32First( PIDs, &aPID );
    while ( Found = Eqi( aPID.szExeFile, EXE ),
      KillProc && Found &&
      ( aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ) )
      ? TerminateProcess( aProc, 9 ), CloseHandle( aProc ) : 0,
      !Found && Process32Next( PIDs, &aPID ) );

    KillProc = 0, CloseHandle( PIDs );  return  Found ;    }

  int  Verify ;

  void Launch( LnP Cmd ) {  LnP  EXE ;  wchar  _Cmd[333];  
    static PROCESS_INFORMATION Stat ;
    static STARTUPINFO SU = { sizeof SU };

    SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
    ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;
    P = FromEnd( Cmd, '/' ), EXE = Verify && P ? ++P : 0 ;
    ReRun:    if ( EXE && Running( EXE ) ) goto CleanUp ;
    if ( !CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ) ) goto CleanUp ;
    CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread );
    if ( Verify ) {  Sleep(99) ;  goto ReRun ;  }
    CleanUp:    Verify = 0 ;   }

lol

unread,
Jul 21, 2018, 6:20:04 PM7/21/18
to
> Wow, lazy evaluation instead of a proper if() and nested ? operators with comma
> seperated multiple statements. And I thought Alfs code was an unmaintainable
> mess but he has nothing on this guy.

Our village idiot Jeff is clearly something, isn't he?

Bart

unread,
Jul 21, 2018, 7:41:28 PM7/21/18
to
I /think/ that code is structured something like the following:

if (!Mark || Secs>(Mark+3)) {
Mark = Secs;
Cnt = 1;
} else
if (++Cnt>3) {
Mark = Secs;
Cnt = 1;
Keyboard = FindWindows(0,"...");
if (Keyboard) {
SendMessage(Keyboard,274,0,0);
} else {
0;
}
Launch("...");
} else {
0;
}
}

If so, then those dummy 0 expressions might only be there as the
required third operand of ?:, so are not really necessary:

if (!Mark || Secs>(Mark+3)) {
Mark = Secs;
Cnt = 1;
} else
if (++Cnt>3) {
Mark = Secs;
Cnt = 1;
Keyboard = FindWindows(0,"...");
if (Keyboard) {
SendMessage(Keyboard,274,0,0);
}
Launch("...");
}
}

This still takes double the number of lines, but is much easier to follow.

(Here I admit I cheated by using a tool to decipher the structure. But
you shouldn't need to use any tool.)

--
bart

Jeff-Relf.Me

unread,
Jul 22, 2018, 1:18:11 PM7/22/18
to
stackoverflow.com/questions/50623154/c-sharp-wpf-windows-10-1803-touchkeyboard-unreliable-issue-prism-clickonce
More like this:

    //  - Ensure InputApp and TabTip are running
    //    ( may have to ReStart Explorer ).
    //  - If the previous keyboard toggle Failed, kill InputApp, try again.
    //  - Toggle the keyboard.

    if ( WM == WM_HOTKEY && C == 'K' ) {  //  A mouse button takes me here.
      int  Fail, Up ;  static int  PrevUp = -1 ;
      u64  u[2] ;  IFrameworkInputPane  *kb ;
  
      //  - Ensure InputApp and TabTip are running
      //    ( may have to ReStart Explorer ):
      ReTry:    !InputApp ? eXplorer, InputApp : 0,  TabTip ;

      Fail = 1, Up = -1, kb = 0, CoCreateInstance( CLSID_FrameworkInputPane, 0,
         CLSCTX_INPROC_SERVER, IID_IFrameworkInputPane, (void**) &kb);
  
      kb ? kb->Location( (RECT*)&u ), Up = !!( *u + u[1] ),
           Fail = Up == PrevUp, PrevUp = Up, kb->Release() : 0 ;
  
      //  - If the previous keyboard toggle Failed, kill InputApp, try again:

      if ( Fail ) {

        PrevUp = -1, KillProc = 1, Running( L"WindowsInternal.ComposableShell"
        L".Experiences.TextInput.InputApp.EXE" );   goto ReTry ;   }

      static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC, 0x4f88,
         0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
      static const GUID IID_ITipInvocation   = { 0x37c994e7, 0x432b, 0x4834,
         0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
      struct ITipInvocation : IUnknown {  virtual HRESULT STDMETHODCALLTYPE
         Toggle( HWND wnd ) = 0;  }  * KB = 0 ;
      CoCreateInstance( CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER |
         CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**) & KB );
  
      //  Toggle the keyboard ( Firefox and Chrome require this ):
      KB ? KB->Toggle( GetDesktopWindow() ), KB->Release() : 0 ;   }
        .....
    //  Poorly documented, "NTDDI_WIN10" is _vital_:
    #define  NTDDI_VERSION  NTDDI_WIN10
  
    //  To get the process list, and kill stuff: 
    #include <tlhelp32.H>
  
    //  To know if the keyboard is up or not: 
    #include <ShObjIdl.H>
      
    #define  Eqi  !strCmpI
    #define  FromEnd  wcsrchr

    #define  eXplorer  ( Verify = 1, Launch(  \
       L"%ComSpec% /C \"taskkill /f /im explorer && start explorer\""  ) )

    #define  InputApp  ( Verify = 1, Launch(           \
       L"%WinDir%/SystemApps/InputApp_cw5n1h2txyewy/"  \
       L"WindowsInternal.ComposableShell.Experiences"  \
       L".TextInput.InputApp.EXE"  ) )

    #define  TabTip  ( Verify = 1, Launch(  \
       L"%CommonProgramW6432%/microsoft shared/ink/TabTip.EXE"  ) )

    typedef wchar  *LnP ;
    typedef unsigned __int64  u64 ;
  
          int  KillProc ;
    int Running( LnP EXE ) {  int  Found ;
  
      HANDLE  PIDs, aProc ;  PROCESSENTRY32  aPID = { sizeof aPID };
      PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
      Process32First( PIDs, &aPID );
      while ( Found = Eqi( aPID.szExeFile, EXE ),
        KillProc && Found &&
        ( aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ) )
        ? TerminateProcess( aProc, 9 ), CloseHandle( aProc ) : 0,
        !Found && Process32Next( PIDs, &aPID ) );
  
      KillProc = 0, CloseHandle( PIDs );  return  Found ;    }
  
          int  Verify ;
    int Launch( LnP Cmd ) {  
      int  V = Verify ;  Verify = 0 ;  LnP  EXE ;  wchar  _Cmd[333];
      static PROCESS_INFORMATION Stat ;
      static STARTUPINFO SU = { sizeof SU };
  
      SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
      ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;
      P = FromEnd( Cmd, '/' ), EXE = V && P ? ++P : 0 ;
      ReRun:    if ( EXE && Running( EXE ) ) return  1 ;
      if ( V == -1 ) {
        Sh( L"<%s> dies after launching.", Cmd );  return  0 ;  }

      if ( !CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ) ) {
        int  Err = GetLastError();  wchar  Msg[333];  *Msg = 0 ; 
        FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, 0, Err, 0, Msg, 333, 0 );
        Sh( L"Error: %d, %s\n\n  <%s> wasn't launched", Err, Msg, Cmd );
        return  0 ;  }

      CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread );

      if ( !V ) return  1 ;  V = -1, Sleep(999);  goto ReRun ;   }

Jeff-Relf.Me

unread,
Jul 23, 2018, 6:12:32 AM7/23/18
to
stackoverflow.com/questions/50623154/c-sharp-wpf-windows-10-1803-touchkeyboard-unreliable-issue-prism-clickonce

ITipInvocation.Toggle() fails* if it's called more than once a second; so:
[ *: BIG TIME; long stalls, Explorer ReStarts, etc. ]

typedef LARGE_INTEGER DubInt ; unsigned __int64 u64 ;
u64 _Tics, Hz ; double _Secs, _Hz ;
#define Tics ( QueryPerformanceCounter( ( DubInt * ) & _Tics ), _Tics )
#define Secs ( _Secs = Tics / _Hz )
// CoInitialize(0), QueryPerformanceFrequency( (DubInt *) &Hz ), _Hz = Hz ;

if ( WM == WM_HOTKEY && C == 'K' ) { // A mouse button takes me here.

static double Mark ;
// Ensure that 1 second has passed since the last keyboard toggle:
Secs < Mark + 1 ? Sleep( 999 - 999*( _Secs - Mark ) ) : 0, Mark = _Secs ;

Jeff-Relf.Me

unread,
Jul 23, 2018, 7:35:00 PM7/23/18
to
stackoverflow.com/questions/50623154/c-sharp-wpf-windows-10-1803-touchkeyboard-unreliable-issue-prism-clickonce
I'm narrowing it down, hopefully.
To toggle the keyboard on and off:

if ( WM == WM_HOTKEY && C == 'K' ) { // A mouse button takes me here.
static double Mark ; // Jeff-Relf.Me/g600.PNG

// "TabTIP.EXE" ( Tablet Touch Input Pane ) must be invoked at least once;
// it needs to be launched periodically as well, I think,
// but I'm not sure how often; more than once a minute is bad, I think.

Secs > Mark + 60 ?
Launch( L"%CommonProgramW6432%/microsoft shared/ink/TabTIP.EXE" ),
Mark = _Secs : 0;

static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC, 0x4f88,
0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
static const GUID IID_ITipInvocation = { 0x37c994e7, 0x432b, 0x4834,
0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
struct ITipInvocation : IUnknown { virtual HRESULT STDMETHODCALLTYPE
Toggle( HWND wnd ) = 0; } * KB = 0 ;
CoCreateInstance( CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER |
CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**) & KB );

// Toggle the keyboard ( Firefox and Chrome require this ):
KB ? KB->Toggle( GetDesktopWindow() ), KB->Release() : 0 ; }
......
typedef LARGE_INTEGER DubInt ; unsigned __int64 u64 ;
u64 _Tics, Hz ; double _Secs, _Hz ;
#define Tics ( QueryPerformanceCounter( ( DubInt * ) & _Tics ), _Tics )
#define Secs ( _Secs = Tics / _Hz )
// CoInitialize(0), QueryPerformanceFrequency( (DubInt *) &Hz ), _Hz = Hz ;

Launch( wchar *Cmd ) { wchar _Cmd[333]; static PROCESS_INFORMATION Stat ;
static STARTUPINFO SU = { sizeof SU };
SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;
if ( CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ) )

Jeff-Relf.Me

unread,
Jul 25, 2018, 8:48:50 AM7/25/18
to
stackoverflow.com/questions/50623154/c-sharp-wpf-windows-10-1803-touchkeyboard-unreliable-issue-prism-clickonce

When the keyboard toggle ( ITipInvocation.Toggle() )
doesn't work for a minute ( Win10 Ver 1803 ),
killing "...TextInput.InputApp.EXE" is the fix.

So, to toggle the keyboard on and off ( from X.CPP in Jeff-Relf.Me/X.ZIP ):

if ( WM == WM_HOTKEY && C == 'K' ) {

// A mouse button takes me here. Jeff-Relf.Me/g600.PNG

static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC, 0x4f88,
0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
static const GUID IID_ITipInvocation = { 0x37c994e7, 0x432b, 0x4834,
0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
static struct ITipInvocation : IUnknown { virtual HRESULT STDMETHODCALLTYPE
Toggle( HWND wnd ) = 0; } * KB ;

#define ToggleKB ( KB = 0, CoCreateInstance( CLSID_UIHostNoLaunch, \
0, CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER, \
IID_ITipInvocation, (void**) & KB ), \
KB ? KB->Toggle( GetDesktopWindow() ), KB->Release() : 0 )

// InputApp and TabTIP are _always_ killed.
// IfAndOnlyIf InputApp _was_ running:
// The keyboard was up, and ToggleKB worked,
// taking the keyboard down ( Firefox&Chrome require ToggleKB ).

if ( ToggleKB, KillProc = 1, Running( L"TabTIP.EXE" ),
KillProc = 1, !Running( L"WindowsInternal.ComposableShell"
L".Experiences.TextInput.InputApp.EXE" ) )

// InputApp was _not_ running,
// launch "TabTIP" ( Tablet Touch Input Pane ):

Launch( L"%CommonProgramFiles%/microsoft shared/ink/TabTIP.EXE" ),

// Wait first (important),
// then bring the keyboard up ( Firefox&Chrome require ToggleKB ):

Sleep(99), ToggleKB ; }
. . . . . . .
// To get the process list, and kill stuff:
#include <tlhelp32.H>

int KillProc ;
int Running( LnP EXE ) { int Found ; HANDLE PIDs, aProc ;
PROCESSENTRY32 aPID = { sizeof aPID };
PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
Process32First( PIDs, &aPID );
while ( Found = Eqi( aPID.szExeFile, EXE ),
KillProc && Found && (
aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ),
aProc ? TerminateProcess( aProc, 9 ), CloseHandle( aProc ) : 0 ),
!Found && Process32Next( PIDs, &aPID ) );

KillProc = 0, CloseHandle( PIDs ); return Found ; }

Launch( wchar *Cmd ) { wchar _Cmd[333]; static PROCESS_INFORMATION Stat ;
static STARTUPINFO SU = { sizeof SU };
SetEnvironmentVariable( L"__compat_layer", L"RunAsInvoker" );
ExpandEnvironmentStrings( Cmd, _Cmd, 333 ), Cmd = _Cmd ;
if ( CreateProcess( 0, Cmd, 0,0,1,0,0,0, &SU , &Stat ) )
CloseHandle( Stat.hProcess ), CloseHandle( Stat.hThread ); }

// CoInitialize(0);

Colonel Edmund J. Burke

unread,
Jul 25, 2018, 9:59:56 AM7/25/18
to
On 7/10/2018 1:56 PM, assworm babbled:

> wait until you see what a real computer can do

And living up in the Arctic Circle, one is always a step ahead of the mainstream electronics crowd.
LOL

IDIOT!

Colonel Edmund J. Burke

unread,
Jul 25, 2018, 10:00:41 AM7/25/18
to
Quit poasting this horseshit, you anus!

Jeff-Relf.Me

unread,
Jul 28, 2018, 3:31:22 PM7/28/18
to
https://stackoverflow.com/questions/38774139/show-touch-keyboard-tabtip-exe-in-windows-10-anniversary-edition#51376030

The keyboard toggle ( ITipInvocation.Toggle() )
does _ N O T _ always bring up the "touch keyboard"
( Win10 DesktopMode Ver 1803 ).

The solution: use IFrameworkInputPane.Location() to see if the keyboard
is "down" ( off screen ) and, if it is, kill the keyboard processes
and relaunch them before bringing it "up" ( on screen ) again.

This solution has been tested by me, over several days,
and confirmed to work every time, no ( R A N D O M ) stalling.

To toggle the keyboard on and off ( from X.CPP in Jeff-Relf.Me/X.ZIP ):

if ( WM == WM_HOTKEY && C == 'K' ) {

// A mouse button takes me here. Jeff-Relf.Me/g600.PNG

unsigned __int64 u[2] ; IFrameworkInputPane *Loc ;
Loc = 0, CoCreateInstance( CLSID_FrameworkInputPane, 0,
CLSCTX_INPROC_SERVER, IID_IFrameworkInputPane, (void**) & Loc );

// "__int64 u[2]" is the same size as "RECT";
// both are four 32 bit ints: top, left, bottom, right.

if ( !Loc || ( Loc->Location( (RECT*)&u ), Loc->Release(), !*u && !u[1] ) )

// The keyboard is "down" ( off screen ),
// Kill&ReStart it before bringing it "up" ( on screen ).

KillProc = 1, Running( L"TabTIP.EXE" ), KillProc = 1, Running(
L"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE" ),
Launch( L"%CommonProgramFiles%/microsoft shared/ink/TabTIP.EXE" ),
Sleep(99);

static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC, 0x4f88,
0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
static const GUID IID_ITipInvocation = { 0x37c994e7, 0x432b, 0x4834,
0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
static struct ITipInvocation : IUnknown { virtual HRESULT
STDMETHODCALLTYPE Toggle( HWND wnd ) = 0 ; } * Tog ;

Tog = 0, CoCreateInstance( CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER
| CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**) & Tog );

// Toggle the keyboard On|Off:

Tog ? Tog->Toggle( GetDesktopWindow() ), Tog->Release() : 0 ; }
- - - - - - - - - - - - -
// Poorly documented, "NTDDI_WIN10" is _vital_:
#define NTDDI_VERSION NTDDI_WIN10

// To get the process list, and kill stuff:
#include <tlhelp32.H>

// To know if the keyboard is up or not:
#include <ShObjIdl.H>


int KillProc ;
int Running( wchar * EXE ) { int Found ; HANDLE PIDs, aProc ;
PROCESSENTRY32 aPID = { sizeof aPID };
PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
Process32First( PIDs, &aPID );
while ( Found = !strCmpI( aPID.szExeFile, EXE ),
KillProc && Found && (
aProc = OpenProcess( PROCESS_TERMINATE, 0, aPID.th32ProcessID ),
aProc ? TerminateProcess( aProc, 9 ), CloseHandle( aProc ) : 0 ),
!Found && Process32Next( PIDs, &aPID ) );

KillProc = 0, CloseHandle( PIDs ); return Found ; }


Launch( wchar * Cmd ) { wchar _Cmd[333]; static PROCESS_INFORMATION Stat ;

Jeff-Relf.Me

unread,
Jul 30, 2018, 9:15:27 AM7/30/18
to
https://stackoverflow.com/a/51376030/5732431

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

To toggle the keyboard on and off ( from X.CPP in Jeff-Relf.Me/X.ZIP ):

if ( WM == WM_HOTKEY && C == 'K' ) {

// A mouse button takes me here. Jeff-Relf.Me/g600.PNG

if ( KillProc = 1, Running( L"TabTIP.EXE" ), KillProc = 1, Running(
L"WindowsInternal.ComposableShell.Experiences.TextInput.InputApp.EXE"
) )

// The keyboard was _On_ ( i.e. its processes were running ),
// so it was "turned _Off_" (killed); and we're done.

goto Done ;

// The keyboard was _Off_ ( i.e. no running processes ).
// Turn it _On_:

Launch( L"%CommonProgramFiles%/microsoft shared/ink/TabTIP.EXE" );
Sleep(99);

static const GUID CLSID_UIHostNoLaunch = { 0x4CE576FA, 0x83DC,
0x4f88, 0x95, 0x1C, 0x9D, 0x07, 0x82, 0xB4, 0xE3, 0x76 };
static const GUID IID_ITipInvocation = { 0x37c994e7, 0x432b,
0x4834, 0xa2, 0xf7, 0xdc, 0xe1, 0xf1, 0x3b, 0x83, 0x4b };
static struct ITipInvocation : IUnknown { virtual HRESULT
STDMETHODCALLTYPE Toggle( HWND wnd ) = 0 ; } * Tog ;

Tog = 0, CoCreateInstance( CLSID_UIHostNoLaunch, 0, CLSCTX_INPROC_HANDLER
| CLSCTX_LOCAL_SERVER, IID_ITipInvocation, (void**) & Tog );

// Firefox and Chrome need this:

Tog ? Tog->Toggle( GetDesktopWindow() ), Tog->Release() : 0 ; }
- - - - - - - - - - - - -
// To get the process list, and kill stuff:
#include <tlhelp32.H>

0 new messages