Correct way to stop asynchronous ISearchJob
问题 I am going to use WUA API and begin execution of an asynchronous search for updates in this way: CComPtr<SearchCallbackImpl> iscc_; <<-- Note you need to CreateInstance CComPtr<ISearchJob> pUpJob_; pUpJob_ = NULL; pUpSearcher_->BeginSearch( CComVariant(criteria.c_str()).bstrVal, iscc_, CComVariant(L"Scanning"), &pUpJob_); When I need to stop my program, but ISearchJob has not completed yet, I use this code: if (pUpJob_) { CComVariant isStopped; pUpJob_->get_IsCompleted(&isStopped.boolVal); if