Обнаружил это сегодня, хотя, взглянув на Surface Toolkit для Windows Touch, похоже, справляется со своей задачей.
// override on the Window class
protected override void OnSourceInitialized(EventArgs e)
{
EnableTabletGestures(this, false);
}
[DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
public static extern short GlobalAddAtom(string atom);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr RemoveProp(IntPtr hWnd, string atom);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int SetProp(IntPtr hWnd, string atom, IntPtr handle);
public bool EnableTabletGestures(Window window, bool enable)
{
var hWnd = ((HwndSource)PresentationSource.FromVisual(window)).Handle;
long num = 0L;
string atom = "MicrosoftTabletPenServiceProperty";
num = GlobalAddAtom(atom);
if (num == 0L)
{
return false;
}
if (enable)
{
return (RemoveProp(hWnd, atom).ToInt64() == 1L);
}
int num2 = 0x1010019;
return (SetProp(hWnd, atom, new IntPtr(num2)) == 1);
}