AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Windows Update Agent Update-Titel

Ein Thema von Smaraner · begonnen am 22. Jul 2014 · letzter Beitrag vom 23. Jul 2014
Antwort Antwort
Smaraner
(Gast)

n/a Beiträge
 
#1

Windows Update Agent Update-Titel

  Alt 22. Jul 2014, 15:40
Hallo,

ich habe mir mal Windows Update Agent angesehen (http://theroadtodelphi.wordpress.com...i-wmi-and-wua/) und wollte das jetzt für ein Programm nutzen. Ich stehe aber ein bisschen auf dem Schlauch. Der Code zur Updatesuche:

Delphi-Quellcode:
procedure GetListNotInstalledUpdates;
var
  updateSession : OleVariant;
  updateSearcher : OleVariant;
  updateSearchResult : OleVariant;
  updateEntry : OleVariant;
  UpdateCollection : OleVariant;
  oEnum : IEnumvariant;
  iValue : LongWord;
begin
  updateSession:= CreateOleObject('Microsoft.Update.Session');
  updateSearcher := updateSession.CreateUpdateSearcher;
  Writeln('Searching');
  updateSearchResult:= updateSearcher.Search(Format('IsInstalled = 0 and Type=%s',[QuotedStr('Software')]));
  UpdateCollection := updateSearchResult.Updates;
  oEnum := IUnknown(UpdateCollection._NewEnum) as IEnumVariant;
  while oEnum.Next(1, updateEntry, iValue) = 0 do
  begin
    Writeln(updateEntry.Title);
    updateEntry:=Unassigned;
  end;
  Writeln('Done');
end;
Der Code zur Installation:

Delphi-Quellcode:
function ISHotFixID_Installed(const HotFixID : string): Boolean;
var
  updateSession : OleVariant;
  updateSearcher : OleVariant;
  updateEntry : OleVariant;
  updateSearchResult : OleVariant;
  UpdateCollection : OleVariant;
  oEnum : IEnumvariant;
  iValue : LongWord;
begin
 result:=False;
  updateSession:= CreateOleObject('Microsoft.Update.Session');
  updateSearcher := updateSession.CreateUpdateSearcher;
  //this line improves the performance , the online porperty indicates whether the UpdateSearcher goes online to search for updates. so how we are looking for already installed updates we can set this value to false
  updateSearcher.online:=False;
  updateSearchResult:= updateSearcher.Search(Format('IsInstalled = 1 and Type=%s',[QuotedStr('Software')]));
  UpdateCollection := updateSearchResult.Updates;
  oEnum := IUnknown(UpdateCollection._NewEnum) as IEnumVariant;
  while oEnum.Next(1, updateEntry, iValue) = 0 do
  begin
    Result:=Pos(HotFixID,updateEntry.Title)>0;
    updateEntry:=Unassigned;
    if Result then break;
  end;
end;
Ich dachte mir, dass ich in der While Schleife der Procedur zur Update-Suche einfach die Funktion zur Update-Installation aufrufe:

ISHotFixID_Installed(updateEntry.Title); Nur enthält updateEntry.Title den Titel und nicht die richtige Bezeichnung und somit werden die Updates nicht installiert.
  Mit Zitat antworten Zitat
Smaraner
(Gast)

n/a Beiträge
 
#2

AW: Windows Update Agent Update-Titel

  Alt 23. Jul 2014, 17:47
Ich benötige die Hot Fix ID. Diese wird beim Update-Namen in Klammern angegeben. Ich würde diese sonst aus dem Namen extrahieren, aber es gibt sicher eine einfachere Lösung.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:57 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz