这里是对API的引用 http://msdn.microsoft.com/en-us/library/aa387287(v = VS.85).aspx 解决方案 嗨:感谢您的提问.您还没有弄清楚什么不起作用?"您看到什么失败?等但是,我研究了WUA,并在MSDN上下载了进度部分.您是否在代码中实现IDownloadProgressChangedCallback :: Invoke方法? http://msdn.microsoft.com/en-us/library/aa385875(VS .85).aspx 在IDownloadProgressChangedCallback :: Invoke内部,您应该等待IUpdateDownloader :: EndDownload方法,下载完成后,应进一步执行该操作.让我知道这是否有帮助,或者请提供您所遇到问题的更多详细信息. Wendell HI,Im writing a Windows Form in C# for managing Windows Updates using the WUA API (WUApiLib) on Windows 7/2008R2Im trying to get the progress from an IDownloadJob using the BeginDownload but it's not working!  Here's the sort of thing Im trying to achieve.  If anyone knows the solution, please please help! It's driving me squirrel food :)//IDownloadProgressChangedCallbackprivatevoid onProgressChanged(IDownloadJob job, IDownloadProgressChangedCallbackArgs e){}// IDownloadCompletedCallback privatevoid onCompleted(IDownloadJob job, IDownloadCompletedCallbackArgs e){} privatevoid Download(){ UpdateSession s = newUpdateSession(); UpdateDownloader ud = s.CreateUpdateDownloader(); ud.Updates = updatesToDownload; IDownloadJob dwn = ud.BeginDownload(onProgressChanged,onCompleted, null);} Here's a reference to the BeginDownload methodhttp://msdn.microsoft.com/en-us/library/aa386132(v=VS.85).aspxHere's a reference to the APIhttp://msdn.microsoft.com/en-us/library/aa387287(v=VS.85).aspx 解决方案 Hi:Thanks for your question. You have not made it clear “what is not working?” What failure do you see? etcHowever, I researched on WUA and download progress part on MSDN.Are you implementing IDownloadProgressChangedCallback::Invoke Method in your code?http://msdn.microsoft.com/en-us/library/aa385875(VS.85).aspxInside IDownloadProgressChangedCallback::Invoke you should be waiting on IUpdateDownloader::EndDownload Method and when the download will be completed, the execution should continue further.Let me know if this is helpful or please give more details of the question you have.Wendell 这篇关于IDownloadJob异步BeginDownload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 06:03