Skip to content

Separating Mouse Cursor movement when touch operation is performed on WPF application #10191

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice]

MainWindow.xaml

MainWindow.xaml.cs
We would like to seek a technical help on simulating the behavior of virtual touch pad in our application on windows 10.
Following are the details based on the analysis done so far.

Problem Statement:

  • When touch operations are performed on a WPF application, the mouse cursor/pointer moves to the same location where first touch is done.
  • Mouse cursor/pointer is not visible

Expected output:

  • The mouse cursor/pointer should move on desktop when user performs touch and drag operation on an application
  • We don’t want mouse cursor/pointer to move its position when touch operation is performed

Sample application details:

  • Application type : WPF app
  • Canvas is added on window to capture touch events.
  • Dot Net Framework : 4.8
    Note: The sample XAML and Code behind is attached to this message

Analysis done so far:
The following option were tried, but we couldn’t get the mouse cursor separated from touch operations:

  1. Using hooks to filter the low-level mouse events
    - API name: SetWindowsHookEx
    a. The hook is applied to capture the Low-level mouse input events using Hook procedure for WH_MOUSE_LL = 14;
    • In call back function check as below:
      a. If touch is active and if mouse event is received then filter out the mouse events
      private static IntPtr MouseHookCallback(int nCode, IntPtr wParam, IntPtr lParam)
  2. Mouse cursor/pointer movement
    • It is observed that when touch is performed the cursor/pointers is not visible
    • We tried to set the visibility with Native Win32 API; s but couldn't get the cursor visible

Query:
We would like to seek help to get the mouse cursor/pointer movement and visibility on screen and controlled by touch operations from custom application in WPF


Original Comments

Feedback Bot on 11/27/2024, 07:25 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

U_1405585 on 12/4/2024, 03:10 PM:

(private comment, text removed)

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionGeneral question, not a problem in source code or documentation (yet)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions