首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

怎么获取系统的应用程序

2012-03-07 
如何获取系统的应用程序如何获取系统的应用程序,就象360桌面程序一样[解决办法]HKEY_LOCAL_MACHINE\SOFTWA

如何获取系统的应用程序
如何获取系统的应用程序,就象360桌面程序一样

[解决办法]
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall下的所有项,其中的DisplayName键值
[解决办法]

Delphi(Pascal) code
procedure TForm1.Button1Click(Sender: TObject);var  reg: TRegistry;  myList: TStringList;  i: integer;  curkey, SName: string;begin  reg := TRegistry.Create;  myList := TStringList.Create;  reg.RootKey := HKEY_LOCAL_MACHINE;  if reg.OpenKey('Software\Microsoft\Windows\CurrentVersion\uninstall', False)    then  Begin    reg.GetKeyNames(myList);    curkey := reg.CurrentPath;    reg.CloseKey;    for i := 0 to myList.Count - 1 do      if reg.OpenKey(curkey + '\' + myList.Strings[i], False) then      Begin        if reg.ValueExists('DisplayName') then          SName := reg.ReadString('DisplayName')        else          SName := myList.Strings[i];        //if reg.ValueExists('DisplayVersion') then        //  SName := SName + ' 版本:' + reg.ReadString('DisplayVersion');        ListBox1.Items.Add(SName);        reg.CloseKey;      end;      ListBox1.Sorted :=True;  end;end; 

热点排行