次の方法で共有


IDebugExpression2::EvaluateAsync

This method evaluates the expression asynchronously.

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 IDebugProgram2::Attach or IDebugEngine2::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

Reference

IDebugExpression2

IDebugExpressionEvaluationCompleteEvent2

EVALFLAGS

IDebugEventCallback2