What is wrong with this code?

Vijayadithyan .N 121 Reputation points
2022-05-06T15:55:42.31+00:00

I mooved recently from c++/cx to Winrt, And usually i would do it like this:

window.PointerPressed^ += new TypedEventHandler<CoreWindow^, PointerEventArgs^>(this, App::OnPointerPressed);

and it would work fine, but when i mooved it to winrt, i thought i would have to write it like this:

window.PointerPressed += new TypedEventHandler<CoreWindow, PointerEventArgs>(this, App::OnPointerPressed)

It threw an error but it could easily be resolved by writing it like this:

window.PointerPressed& += new TypedEventHandler<CoreWindow, PointerEventArgs>(this, App::OnPointerPressed);

but then three more errors showed up, Namely: CS2059, E0300, and C259 - Syntax Error '+='

How Can i Fix this?

Universal Windows Platform (UWP)
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 112.1K Reputation points
    2022-05-06T16:13:43.567+00:00

    Try something like this:

    window.PointerPressed( { this, &App::OnPointerPressed } );


0 additional answers

Sort by: Most helpful