Recent

Author Topic: [INFO] Use TRegistry to get list of installed programs on Windows 32/64-bit  (Read 2992 times)

JimD

  • Jr. Member
  • **
  • Posts: 62
The attached example is my attempt to consolidate the information from this post and others:
   https://forum.lazarus.freepascal.org/index.php/topic,33990.15.html

I'm hoping this will help others use TRegistry to get the list of installed programs on Windows.

Tested using Virtualbox on WinXP, Win7, and Win10 - both 32 and 64-bit
   
My Config:
  Windows 10 Home 64-bit
  Lazarus 1.8.2 with FPC 3.0.4 64 bit, and cross-i386-win32-win64

wp

  • Hero Member
  • *****
  • Posts: 11857
Thanks for sharing. But you should call BeginUpdate/EndUpdate to avoid scrolling the memo while adding lines:
Code: Pascal  [Select][+][-]
  1. procedure TfrmMain.ShowList(aTitle: string; aList: TStringList);
  2. var
  3.   i: integer;
  4. begin
  5.   aList.sort;
  6.   Memo.Lines.BeginUpdate;     // <-- inhibits repainting of Memo
  7.   try
  8.     Memo.Append(aTitle);
  9.     for i:=0 to aList.Count-1 do begin
  10.       Memo.Append(Format('%4d: %s', [i+1, aList[i]]));
  11.     end;
  12.   finally
  13.     Memo.Lines.EndUpdate;    // <-- activates repainting of Memo again.
  14.   end;
  15. end;
« Last Edit: May 07, 2018, 10:36:38 am by wp »

JimD

  • Jr. Member
  • **
  • Posts: 62
Thank you, wp!
I have used Memo.Enabled:=true/false on other projects.
I like your suggestion much better.
I learned something new today.

 

TinyPortal © 2005-2018