PDA

View Full Version : Background Downloading with Delphi



Jan_Cieslicki
05-19-2003, 05:30 AM
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?

hlogmans
05-27-2003, 09:26 AM
You must declare:

UpdateInstance : OleVariant;

then it works fine. It just does not use a static interface, see importfile.

Jan_Cieslicki
06-06-2003, 04:27 AM
Thanks. It works great now:)