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
windows ruby com win32ole wuapi


source to share


No one has answered this question yet

Check out similar questions:

2453
How do I install pip on Windows?
1998
How to write a switch statement in Ruby
1975
How do I know which process is listening on a port on Windows?
475
How do I update the current line in a C # windows console application?
211
Given the class, see if the instance has a method (Ruby)
160
How does the C # compiler detect COM types?
five
Using Windows COM Objects in node.js
2
Implementing a COM interface (exposed via .NET / C #) in Ruby
1
COM: Vendor-supplied TLB file
0
Using Win32OLE Library in Ruby to Automate Custom C # Application



All Articles
Loading...
X
Show
Funny
Dev
Pics