![]() To fix this, you should update the lambda function to take a parameter of type concurrency::task. In your code, you are providing a lambda function that takes a parameter of type ExtendedExecutionResult, causing the type mismatch. ![]() The then method expects a callable object that takes a parameter of type concurrency::task, where T is the expected return type. To resolve this error, you need to modify the lambda function to match the expected parameter type. In your case, the issue lies in the line where you call create_task(session.RequestExtensionAsync()).then( this. The error C2338 in C++/WinRT indicates a mismatch between the expected parameter type and the actual type provided when using the then method. I'd be happy to help you out with your question. Just save the settings without asking the user. I will be using a MessageDialog to ask the user if they what to save settings. ![]() Save the settings that have not be saved when exiting. IAsyncAction App::BeginExtendedExecution(ExtendedExecutionSession session, SuspendingDeferral deferral, event_token revokedToken)Ĭreate_task(session.RequestExtensionAsync()).then((ExtendedExecutionResult result) //<- this line has the problem Session.Reason(ExtendedExecutionReason::SavingData) Įvent_token revokedToken = session.Revoked(TypedEventHandler(this, &App::ExtendedExecutionSessionRevoked)) īeginExtendedExecution(session, deferral, revokedToken) SuspendingDeferral deferral = args.SuspendingOperation().GetDeferral() ĮxtendedExecutionSession session = ExtendedExecutionSession() Incorrect parameter type for the callable object in 'then' consider _ExpectedParameterType or task void App::OnSuspending(] IInspectable const& sender, ] SuspendingEventArgs const& args) Those problems were solved, but I cannot figure out what this error means or how to solve it. I could not get the OnSuspending() to accept an IAsyncAction instead of a void, so I put the asynchronous action in another function and just passed in the variables I needed since I could not declare them in the. The line is the create_task in BeginExtendedExecution(). It is only one line that I can't seem to get right and I get this error. I have become very good at converting CX/C++ code to win/rt, but this one stumps me.
0 Comments
Leave a Reply. |