C# – how to enable and disable touch-screen on Windows-CE or Windows-Mobile

cwindows-cewindows-mobile

How to enable and disable touch-screen on Windows-CE or Windows-Mobile ?

I need any C# sample code

Best Answer

After hours of googling finally found a correct answer here:

http://www.hjgode.de/wp/2012/09/24/windows-mobile-disable-touch-input/#more-1543

On the bottom you will find a source code on code.google:

https://code.google.com/p/win-mobile-code/source/browse/#svn%2Ftrunk%2FdisableTouch

The actual working source code for c#:

    [DllImport("coredll.dll", SetLastError = true)]
    private static extern IntPtr GetDesktopWindow();

    [DllImport("touch.dll", SetLastError = true)]
    private static extern bool TouchRegisterWindow(IntPtr hwnd);

    [DllImport("touch.dll", SetLastError = true)]
    private static extern void TouchUnregisterWindow(IntPtr hwnd);

    public static Boolean Disable()
    {
        return TouchRegisterWindow(GetDesktopWindow());
    }

    public static void Enable()
    {
        TouchUnregisterWindow(GetDesktopWindow());
    }