可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
We have a need in one of our apps where we need to disable some of the built in gestures for Windows 8 to prevent users from leaving the app. (think kiosk sign in screen). Are there methods for still allowing the user to interact with the app using touch but disabling/intercepting some of the built in gestures (things like docking the app on the left, going to the desktop, etc).
Our backup solution is to disable touch altogether when in certain screens (this is something we can do) but we'd like a better user experience and to just disable the gestures that we absolutely need to (similar to disabling the windows key, ctrl+alt+del instead of the whole keyboard).
Initial searches and investigation haven't turned up what we've been looking for so we're either looking for the wrong thing or in the wrong places.
回答1:
You can disable gesture in Windows 8 Embedded. Maybe you can try this in Windows 8.
Registry Keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ImmersiveShell\EdgeUI]
"DisabledEdges"=dword:0000000f
0x01 : Disables left edge input and app switcher gesture.
0x02 : Disables right edge input and charm bar gesture.
0x04 : Disables top edge input and top application bar gesture.
0x08 : Disables bottom edge input and bottom application bar gesture.
if you want to disables each gesture, just add dword:0000000f (15)
回答2:
To do it programmatically, you can call the function in the link below. It requires the hWnd to the window you would like to target.
http://msdn.microsoft.com/en-us/library/windows/desktop/jj553591%28v=vs.85%29.aspx
The C++ below will search for a window with the window title "helloworld", and disable all of the Windows 8 gestures for it. This does not work for Windows Store apps, and the function has to be called on the window while it is open. If the application is closed and re-opened, the gestures will return. Also, I believe it only works while the application is full-screen.
#include "stdafx.h"
#include <windows.h>
#include <iostream>
#include <propsys.h>
#include <propkey.h>
using namespace std;
HWND windowHandle;
HRESULT SetTouchDisableProperty(HWND hwnd, BOOL fDisableTouch)
{
IPropertyStore* pPropStore;
HRESULT hrReturnValue = SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pPropStore));
if (SUCCEEDED(hrReturnValue))
{
PROPVARIANT var;
var.vt = VT_BOOL;
var.boolVal = fDisableTouch ? VARIANT_TRUE : VARIANT_FALSE;
hrReturnValue = pPropStore->SetValue(PKEY_EdgeGesture_DisableTouchWhenFullscreen, var);
pPropStore->Release();
}
return hrReturnValue;
}
BOOL CALLBACK MyEnumProc(HWND hWnd, LPARAM lParam)
{
TCHAR title[500];
ZeroMemory(title, sizeof(title));
GetWindowText(hWnd, title, sizeof(title)/sizeof(title[0]));
if (!_tcscmp(title, _T("helloworld")))
{
SetTouchDisableProperty(hWnd,true);
}
return TRUE;
}
int _tmain(int argc, _TCHAR* argv[])
{
EnumWindows(MyEnumProc, 0);
return 0;
}
回答3:
Windows charms bar is operated by explorer.exe
.
So if your app can run without it then you can hack around it by first disabling the autorestart of explorer.exe via (run as administrator):
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoRestartShell" /t REG_DWORD /d 0
Then the lines below represent my launch.bat
- which works in the end as expected:
;; kill explorer (this disables all windows functionalities
taskkill /f /im explorer.exe
;; start your kiosk app - should block the batch execution (so explorer.exe doesn't get executed at the end)
"\path\to\your\app.exe"
;; relaunch explorer.exe after you close the app to give back the functionality to windows
explorer.exe
I use the approach outlined above to let a keyboardless kiosk app run. Because with a keyboard you can still close the app with alt+f4.
回答4:
Setting IsTapEnabled, IsDoubleTapEnabled, IsRightTapEnabled, and IsHoldingEnabled to false should disable the gestures in the UI Element but they are properties, not methods. I haven't seen a method that will disable ALL gestures for a particular element.
I know it would be ridiculous to disable each control to respond to the gestures but if you need to disable all controls literally from Root to Children then creating an attach property on the root and setting these properties to false might be a solution.
回答5:
The gestures are handled by explorer.exe.
If your replace the windows shell (default: explorer.exe) with your Application, then there are no more gestures at the OS-level.
Registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows_NT\CurrentVersion\Winlogon\
Key: "Shell" (REG_SZ) = "path_to_your_application"
you can also do this only for the current user (HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows_NT\CurrentVersion\Winlogon)
回答6:
At least in 8.1, there appears to be a feature called Assigned Access:
http://blogs.technet.com/b/askpfeplat/archive/2013/10/28/how-to-setup-assigned-access-in-windows-8-1-kiosk-mode.aspx
http://windows.microsoft.com/en-us/windows-8/assigned-access
Settings > Change PC Settings > Accounts > Other Accounts > Set up an account for assigned access