Hello,
Welcome to Microsoft Q&A,
The CoreWindow.PointerPressed event is fired for the first mouse button pressing detected in the interaction session, and the event is not fired for the second mouse button pressing before the interaction session ends up. Similarly, the CoreWindow.PointerReleased event is fired for only when the last mouse button is released, that is, the event is not fired when your first button is released and the second button is not released.
Therefore, you can not use CoreWindow.PointerPressed
and CoreWindow.PointerReleased
event to detect left and right buttons being pressed simultaneously.
You could use CoreWindow.PointerMoved event to detect your simultaneous two mouse action.
For example,
Void App::SetWindow(CoreWindow^ window)
{
window->PointerMoved+=ref new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, &App::OnPointerMoved);
}
Void App::OnPointerMoved(CoreWindow^ sender, PointerEventArgs^ args)
{
if (args->CurrentPoint->Properties->IsLeftButtonPressed)
{
pressed++; // pressed is an int variable whose initial value is 0, pressed is defind in App.xaml.h
}
if (args->CurrentPoint->Properties->IsRightButtonPressed)
{
released++; // released is an int variable whose initial value is 0, released is defind in App.xaml.h
}
if (pressed&&released)
{
pressed = 0;
released = 0;
//Here we know the right and left button of mouse is pressed
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.