Share via


IDebugExpression2::EvaluateAsync

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This method evaluates the expression asynchronously.

Syntax

HRESULT EvaluateAsync (
    EVALFLAGS             dwFlags,
    IDebugEventCallback2* pExprCallback
);
int EvaluateAsync(
    enum_EVALFLAGS       dwFlags,
    IDebugEventCallback2 pExprCallback
);

Parameters

dwFlags
[in] A combination of flags from the EVALFLAGS enumeration that control expression evaluation.

pExprCallback
[in] This parameter is always a null value.

Return Value

If successful, returns S_OK; otherwise returns an error code. A typical error code is:

Error Description
E_EVALUATE_BUSY_WITH_EVALUATION Another expression is currently being evaluated, and simultaneous expression evaluation is not supported.

Remarks

This method should return immediately after it has started the expression evaluation. When the expression is successfully evaluated, an IDebugExpressionEvaluationCompleteEvent2 must be sent to the IDebugEventCallback2 event callback as supplied through Attach or Attach.

Example

The following example shows how to implement this method for a simple CExpression object that implements the IDebugExpression2 interface.

HRESULT CExpression::EvaluateAsync(EVALFLAGS dwFlags,
                                   IDebugEventCallback2* pExprCallback)
{
    // Set the aborted state to FALSE
    // in case the user tries to redo the evaluation after aborting.
    m_bAborted = FALSE;
    // Post the WM_EVAL_EXPR message in the message queue of the current thread.
    // This starts the expression evaluation on a background thread.
    PostThreadMessage(GetCurrentThreadId(), WM_EVAL_EXPR, 0, (LPARAM) this);
    return S_OK;
}

See also