cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dmalk1
Level 4

Agent Events not being raised

I'm using the Update Service 4.1 Pro SDK, Visual Basic 6.0 for developement, and InstallShield X for updates. I need updates to take place silently therefore am using AutoUpdate.

I have debug.print statements in all 5 of the Agent Events; however, OnDownloadBegin() and OnProgressChanged() are the only 2 events that ever get raised. There are no errors returned and the update does indeed take place properly. I however need know when the update is downloaded and installed.

I've seen other messages on this forum where people have expierenced the same problem; however, no answers have been given. Is this a known error in the SDK? Are there any work-arounds? I need to resolve this quickly so can anyone recommend where I might get an answer to this issue?

Thanks for your time!
Damon

EDIT: Issue resolution described in message #5 below.
0 Kudos
(5) Replies
NealC804
Level 8

I stopped using the OnDownloadComplete as it was sending false indications that downloads were downloaded and available when in fact there were NO updates! I can't trust the events - using VB6 as well.
0 Kudos
dmalk1
Level 4

What means do you use now, if you don't mind my asking. I was hoping to be able to manage the update process transparently without user intervention. Have you found an alternate way to do something like this?

Thanks!
Damon
0 Kudos
NealC804
Level 8

Private Sub CheckISUS()
On Error Resume Next

Dim allowAutoUpdate As Boolean
allowAutoUpdate = GetSetting(App.Title, "AutoUpdateEx", "Enabled", True)

If Not allowAutoUpdate Then Exit Sub

Dim updateFile As String
updateFile = App.Path & "\updates\update.exe"
Dim newFile As String
newFile = App.Path & "\updates\LogbookProUpdate.exe"

If Dir(updateFile) <> "" Then Exit Sub

Dim i As Integer

If Len(ProductCode) > 3 Then
Set UpdateAgent = New Agent

If UpdateAgent.IsConnected Then
Set UpdateCollection = UpdateAgent.EnumUpdates(ProductCode)

If Not UpdateCollection Is Nothing Then

For i = 1 To UpdateCollection.Count
Set UpdateInstance = UpdateCollection.Item(i)

If UpdateInstance.IsSoftwareUpdate Then

UpdateInfo.Title = UpdateInstance.QueryValue(Title)
UpdateInfo.DownloadURL = UpdateInstance.QueryValue(DownloadURL)
UpdateInfo.DisplayVersion = UpdateInstance.QueryValue(DisplayVersion)
UpdateInfo.ProductName = UpdateInstance.QueryValue(ProductName)
UpdateInfo.DownloadSize = UpdateInstance.QueryValue(DownloadSize)
UpdateInfo.TargetDir = UpdateInstance.QueryValue(TargetDir)
UpdateInfo.Details = UpdateInstance.QueryValue(Details)
UpdateInfo.Description = UpdateInstance.QueryValue(Description)
UpdateInfo.Category = UpdateInstance.QueryValue(Category)
UpdateInfo.LocalFileName = UpdateInstance.QueryValue(LocalFileName)

' If UpdateInstance.IsNextUse Then
If (UpdateInstance.Download(True) = True) Then
ISUSUpdateReady = True

If Dir(App.Path & "\updates") = "" Then
FileSystem.MkDir App.Path & "\updates"
End If

If Dir(updateFile) <> "" Then
FileSystem.Kill updateFile
End If

If Dir(newFile) <> "" Then
FileSystem.Kill newFile
End If

FileSystem.FileCopy UpdateInfo.LocalFileName, updateFile
FileSystem.Kill UpdateInfo.LocalFileName
Exit For
End If
' End If

End If

Next

End If

End If
End If

End Sub
0 Kudos
dmalk1
Level 4

Neal,
I can't thank you enough for assistance here. While attempting to take an approach such as the one you supplied, an obvious mistake I had made surfaced.

I was both creating and then destroying my modular DWUpdateServiceLib.Agent object in my CheckForUpdates() routine. Obviously once the object is destroyed, it'll stop raising events. Ouch, my bad 😮

I'm glad this happened though because you brought my attention to the possible instability of these events. Are you using the 4.1 SDK?

Is anyone else either able or unable to use these Agent Events reliably?

Damon
0 Kudos
mikaweckstrom
Level 2

I had the same problem with OnDownloadComplete. The solution I made is checking the "OnProgressChanged" event. When it reaches "100%", I launch manually the OnDownloadComplete event. I found out that the complete event works when You download the first download but the next ones don't get the complete event anymore.

Hope this helps,

Mika
0 Kudos