locked
Unable to use RegisterPointerInputTarget RRS feed

  • Question

  • Hi I'm trying to upgrade a .Net project running well on Windows7 to Windows8. This program use touch screen capacities.

    On my Windows7 project my code in C# works fine and use the following implementation:

        [DllImport("User32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool RegisterTouchWindow(IntPtr handle, UInt32 flags);

         public AtlEventTouch(IntPtr handle)
        {
            IntPtr hwnd = GetModuleHandle("User32");
            UIntPtr address = GetProcAddress(hwnd, "RegisterTouchWindow");

            if (address != UIntPtr.Zero)
            {
              if (RegisterTouchWindow(handle, 0))                          //<= Here RegisterTouchWindow return true as expected
                _flagTouchCapable = true;                                       // so my flag is set to true
            }
        }

    But now with Windows8 I wish to use the new Api function RegisterPointerInputTarget, so I tried this :  

        [DllImport("User32")]
        [return: MarshalAs(UnmanagedType.Bool)]
        private static extern bool RegisterPointerInputTarget(IntPtr handle, PointerInputType flags);

        public AtlEventTouch(IntPtr handle)
        {
            IntPtr hwnd = GetModuleHandle("User32");
            UIntPtr address = GetProcAddress(hwnd, "RegisterPointerInputTarget");

            if (address != UIntPtr.Zero)
            {
              if (RegisterPointerInputTarget(handle, PointerInputType.TOUCH))       //<= Here RegisterPointerInputTarget return FALSE
                _flagTouchCapable = true;                                                                  // so my flag is NOT set to true
            }
        }

       

        public enum PointerInputType
        {

            POINTER = 0x00000001,

            TOUCH = 0x00000002,

            PEN = 0x00000003,

            MOUSE = 0x00000004,

        }

    Any idea why my dll import does not work properly with this RegisterPointerInputTarget function ?

    Tuesday, May 7, 2013 7:48 AM

All replies

  • hi,I have same issue.did you known how to use RegisterPointerInputTarget ?
    Wednesday, July 31, 2013 4:52 AM