TLama

Untitled

Feb 12th, 2014
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.75 KB | None | 0 0
  1. [Setup]
  2. AppName=My Program
  3. AppVersion=1.5
  4. DefaultDirName={pf}\My Program
  5. OutputDir=userdocs:Inno Setup Examples Output
  6.  
  7. [Code]
  8. function GetWindowsUpdateCount: Integer;
  9. var
  10.   SearchResult: Variant;
  11.   UpdateSession: Variant;
  12.   UpdateSearcher: Variant;
  13. begin
  14.   UpdateSession := CreateOleObject('Microsoft.Update.Session');
  15.   UpdateSession.ClientApplicationID := 'My Inno Setup Installer';
  16.   UpdateSearcher := UpdateSession.CreateUpdateSearcher;
  17.   SearchResult := UpdateSearcher.Search('IsInstalled=0 and Type=''Software'' and IsHidden=0');
  18.   Result := SearchResult.Updates.Count;
  19. end;
  20.  
  21. procedure InitializeWizard;
  22. var
  23.   UpdateCount: Integer;
  24. begin
  25.   UpdateCount := GetWindowsUpdateCount;
  26.   MsgBox(IntToStr(UpdateCount), mbInformation, MB_OK);
  27. end;
Advertisement
Add Comment
Please, Sign In to add comment