I was trying to figure out how to programmatically via C++/# or Windows scripts launch the new Virtual Touchpad that comes with Windows 10, which is supposed to be a Universal Windows Platform app.
After some registry-hacking, I figured out I could launch the Touchpad leveraging launch behavior with registered protocols, like so:
"%SystemRoot%\system32\LaunchWinApp.exe" "ms-virtualtouchpad:"
I found this information at this key:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-virtualtouchpad]
@="URL:Virtual Touchpad"
"EditFlags"=dword:00200000
"URL Protocol"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-virtualtouchpad\Shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-virtualtouchpad\Shell\Open]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ms-virtualtouchpad\Shell\Open\Command]
@=hex(2):22,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,\
00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4c,00,\
61,00,75,00,6e,00,63,00,68,00,57,00,69,00,6e,00,41,00,70,00,70,00,2e,00,65,\
00,78,00,65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00
"DelegateExecute"="{54058896-4775-4C34-8B62-789FB2E263A4}"
Its (Default)
value is REG_EXPAND_SZ
:"%SystemRoot%\system32\LaunchWinApp.exe" "%1"
That DelegateExecute
is related to this key:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CLSID\{54058896-4775-4C34-8B62-789FB2E263A4}]
@="VirtualTouchpadFlow Class"
[HKEY_CLASSES_ROOT\CLSID\{54058896-4775-4C34-8B62-789FB2E263A4}\InProcServer32]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,74,00,77,00,\
69,00,6e,00,75,00,69,00,2e,00,70,00,63,00,73,00,68,00,65,00,6c,00,6c,00,2e,\
00,64,00,6c,00,6c,00,00,00
"ThreadingModel"="Both"
Its (Default)
value is REG_EXPAND_SZ
:%SystemRoot%\system32\twinui.pcshell.dll
So for my non-UWP app or script, I've got enabling it down. The issue then becomes toggling it off. So if it's a UWP app, I'm assuming I need to get it in either the Suspend state, or somehow send it terminate.
There's not much documented for LaunchWinApp
that I can see, and I haven't noticed anything similarly named for Close
/Suspend
/Terminate
.
I'm fine launching the Virtual Touchpad another way, but as far as I can tell, there's no currently existing Q&A on even launching that programmatically.
How should I proceed?
Here's a C++ working code sample for toggling the touchpad open, the closed for anyone interested. I believe you need a touch-enabled display for the touchpad to actually come up. I've been unable to get it working on my touchless desktop.
#include <Windows.h>
#include <iostream>
int main()
{
ShellExecute(0, 0, "ms-virtualtouchpad:", 0, 0, SW_HIDE);
Sleep(1500);
HWND uwp_wnd = HWND();
uwp_wnd = FindWindowEx(0, uwp_wnd, "ApplicationFrameWindow", 0);
if (uwp_wnd)
{
HWND tpad_wnd = HWND();
tpad_wnd = FindWindowEx(uwp_wnd, tpad_wnd, "Windows.UI.Core.CoreWindow", "Windows Shell Experience Host");
if (tpad_wnd != 0)
{
SendMessage(tpad_wnd, WM_CLOSE, 0, 0);
return 0;
}
}
return 1;
}