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

Background Downloading with Delphi

I am trying to use new Background Downloading function of Update Srvice ver.2.0 with Delphi. I tried to modify VB example given:

......
var
UpdateAgent : IAgentEx;
UpdateCollection : IUpdates;
WithEvents,UpdateInstance : IUpdate;
iIndex : integer;
begin
UpdateAgent := CoAgent.Create;
if UpdateAgent.IsConnectedEx(pszProductCode) then
begin
UpdateCollection := UpdateAgent.EnumUpdates(pszProductCode);
For iIndex := 1 To UpdateCollection.Count do
begin
UpdateInstance := UpdateCollection.Item[iIndex];
If (UpdateInstance.IsNextUse = True) Then
If (UpdateInstance.Download(True) = True) Then
UpdateInstance.Execute;
End;
end;
but I am getting Delphi error message for the line in red, saying that I cannot assign UpdateInstance IUpdate object to an OLE Variable UpdateCollection.Item[iIndex].

Can anyone help?
0 Kudos
(2) Replies
hlogmans
Level 6

You must declare:

UpdateInstance : OleVariant;

then it works fine. It just does not use a static interface, see importfile.
0 Kudos
Jan_Cieslicki
Level 4

Thanks. It works great now:)
0 Kudos