I am going to enumerate not installed updates with Windows Update Agent. And I have one question. Is that a way to discard/stop BeginSearch method (searching process). I have tried to stop search process with EndSearch but it does not stop it. Thanks.
Asked
Active
Viewed 655 times
0
-
How do you know EndSearch doesn't stop the search? What happens? What does EndSearch return? – andlabs Sep 01 '16 at 16:25
-
EndSearch does not return. Program just stops on EndSearch and waits until process is completed. Is that correct behavior? – Space Rabbit Sep 01 '16 at 16:31
-
1Given that you get an ISearchResults out of it, I assume the answer is yes; look into ISearchJob::RequestAbort()? (Call it first, then EndSearch(), then release the ISearchResults as that should just give you a ResultCode of orcAborted... Follow the documentation's hyperlinks =P ) – andlabs Sep 01 '16 at 16:33
-
Thanks man. This is what i need!!! – Space Rabbit Sep 01 '16 at 16:39
1 Answers
1
IUpdateSearcher::EndSearch()
waits for the search to complete first. You can explicitly request the search to stop early by first calling ISearchJob::RequestAbort()
on the ISearchJob
you get from IUpdateSearcher::BeginSearch()
. After doing that, the ISearchResults
returned from EndSearch()
should have a ResultCode
of orcAborted
, and you should be safe with just releasing it. (You should still call EndSearch()
, because the abort operation is still asynchronous, as hinted by the name "request abort".)

andlabs
- 11,290
- 1
- 31
- 52