Share via

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?

Developer technologies | Universal Windows Platform (UWP)
Developer technologies | C++
Developer technologies | 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.

0 comments No comments

Answer accepted by question author

Viorel 127K Reputation points
2022-05-06T16:13:43.567+00:00

Try something like this:

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

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.