🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #262789

Hopefully, I got it right this time ( only time will tell ).

#262789
From: Jeff-Relf.Me
Date: Wed, 18 Jul 2018 03:40
74 lines
4609 bytes
<PRE Style='Font-Family: OCR A, monospace !important;'>
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&amp;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**)&amp;KB ), !KB )

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

    .....
#include &lt;InitGuid.H>
#include &lt;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  &lt;= eJ  )

int Kill( LnP EXE ) { HANDLE  PIDs, aProc = 0 ;  PROCESSENTRY32  aPID;
  PIDs = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
  aPID.dwSize = sizeof( PROCESSENTRY32 ), Process32First( PIDs, &amp;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, &amp;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, &amp;SU , &amp;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 );  }
Technical Details
Message-ID: <Jeff-Relf.Me@Jul.17--8.40pm.Seattle.2018>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.lang.c++.(381507).mbox.7z!not-for-mail
References: <fq0renFglc7U1@mid.individual.net> <phfok1$fmb$3@dont-email.me> <a960d541-aed5-43b0-9fd9-7e6ec469940a@googlegroups.com> <Jeff-Relf.Me@Jul.10--2.24am.Seattle.2018> <Jeff-Relf.Me@Jul.10--1.52pm.Seattle.2018> <0eet1f-5ld.ln1@news.neodome.net> <Jeff-Relf.Me@Jul.15--10.09pm.Seattle.2018> <Jeff-Relf.Me@Jul.16--6.12am.Seattle.2018> <Jeff-Relf.Me@Jul.16--9.02am.Seattle.2018> <Jeff-Relf.Me@Jul.17--1.14am.Seattle.2018>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff-Relf.Me@Jul.17--8.40pm.Seattle.2018>
Subject: Hopefully, I got it right this time ( only time will tell ).
Date: Wed, 18 Jul 2018 03:40:17 +0000
From: Jeff-Relf.Me @.
References: <fq0renFglc7U1@mid.individual.net> <phfok1$fmb$3@dont-email.me> <a960d541-aed5-43b0-9fd9-7e6ec469940a@googlegroups.com> <Jeff-Relf.Me@Jul.10--2.24am.Seattle.2018> <Jeff-Relf.Me@Jul.10--1.52pm.Seattle.2018> <0eet1f-5ld.ln1@news.neodome.net> <Jeff-Relf.Me@Jul.15--10.09pm.Seattle.2018> <Jeff-Relf.Me@Jul.16--6.12am.Seattle.2018> <Jeff-Relf.Me@Jul.16--9.02am.Seattle.2018> <Jeff-Relf.Me@Jul.17--1.14am.Seattle.2018>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.lang.c++.(381507).mbox.7z!not-for-mail
Content-Type: Text/HTML; charset=UTF-8
Content-Transfer-Encoding: 8bit
Newsgroups: comp.os.linux.advocacy,sci.physics,alt.comp.os.windows-10,news.software.readers,comp.lang.c++,alt.checkmate
User-Agent: Jeff-Relf.Me/X.HTM
Lines: 74
X-Complaints-To: abuse@usenet-news.net
NNTP-Posting-Date: Wed, 18 Jul 2018 03:40:17 UTC
Organization: usenet-news.net
X-Received-Bytes: 4416
X-Received-Body-CRC: 1135083883