How do I implement IDownloadProgressChangedCallback using WIN32OLE?
I want to download Windows updates using WIN32OLE in Ruby. I am running into problems knowing which COM object to use to get the arguments needed by IUpdateDownloader :: BeginDownload . For now, I can do the synchronous version of downloading the updates, but I'd love to know how I can use the asynchronous method.
Now something like the following works:
require 'win32ole'
muSession = WIN32OLE.new('Microsoft.Update.Session')
availableUpdates = muSession.CreateUpdateSearcher().Search("IsInstalled=0 and Type='Software'").Updates
muUpdateColl = WIN32OLE.new('Microsoft.Update.UpdateColl')
availableUpdates.each do |update|
update.AcceptEula()
muUpdateColl.Add(update)
end
updateDownloader = WIN32OLE.new('Microsoft.Update.Session').CreateUpdateDownloader()
updateDownloader.Updates = muUpdateColl
downloadResult = updateDownloader.Download()
However, instead of calling Download (), I would like to use BeginDownload (). How can I create an instance of IDownloadProgressChangedCallback (for example). I think it might be obvious in C #, but using WIN32OLE, I'm not sure how to create the object.
+3
source to share
No one has answered this question yet
Check out similar questions: