以編程方式做到這一點,你可以請在下面的鏈接中調用該函數。它需要hWnd到您想要定位的窗口。
http://msdn.microsoft.com/en-us/library/windows/desktop/jj553591%28v=vs.85%29.aspx
的C++下面將搜索窗口標題「HelloWorld」的一個窗口,並禁用它所有的Windows 8手勢。這不適用於Windows應用商店應用,並且該功能必須在打開窗口時調用。如果應用程序關閉並重新打開,手勢將返回。另外,我相信它只在應用程序全屏時才起作用。
#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;
}
我並非真的想要禁用所有元素的手勢。我試圖禁用操作系統級別的手勢。在Win8中,無論應用程序和操作系統會執行某些操作(顯示桌面,引腳到左側等),您都可以執行某些手勢。我需要捕捉/禁用這些操作系統級別的功能。因此,這與我的網頁上的控件無關(實際上,我們希望讓用戶能夠與應用中的控件進行互動)。 –