下面程式是讀出windows中所有的已安裝的程式.你自己看一下,很容易的.
uses registry;
procedure tform1.button1click(sender: tobject);
var list,softlist :tstringlist;
reg :tregistry;
fpath,fkey,substring:string;
i: integer;
begin
fpath := 'software\microsoft\windows\currentversion\uninstall';
fkey := 'displayname';
list := tstringlist.create;
softlist := tstringlist.create;
reg := tregistry.create;
try
reg.rootkey := hkey_local_machine;
if reg.openkey(fpath, false) then
reg.getkeynames(list);
list.sort;
list.beginupdate;
reg.closekey;
if reg.openkey(fpath, false) then
edit1.text := list[0];
:= reg.readstring('driverdesc');
reg.closekey;
for i:=0 to list.count-1 do begin
fpath := 'software\microsoft\windows\currentversion\uninstall\'+list[i];
if (reg.openkey(fpath,false)) and (reg.readstring(fkey)<>'') then
softlist.add(reg.readstring(fkey));
reg.closekey;
end;//end for
finally
reg.free; // 用 try..finally 結構確保 reg 變數能夠釋放。
end;
softlist.sort;
listbox1.items:=softlist;
end;
遍歷登錄檔
123 open register key 4if regopenkeyex hkey current user,software oki ccons33 unittype 0,key all access,oldhkey error success 527 28 print the key and...
讀取登錄檔(delphi)
function readreg xbf widestring widestring var xbfconnect string xbfconn1,regconn2,xbfconn3 string tempregbin array 0.15 of char xbflen integer h1 tha...
遍歷刪除登錄檔
dword deletetree hkey rootkey,const char psubkey nret regqueryinfokey hkey,null,null,null,keycnt,keymaxlen,null,namecnt,namemaxlen,maxdatelen,null,nul...