tseug不是早就帮你解决了吗?
看一下下面的代码:(来自http://www.techvanguards.com ,EventSinkParser )
procedure ReadTypeLib (reg: TRegistry;
const sLibId, sLibVersion: string);
var
sSubkey, sLibDescription, sLibFile: string;
lstSubkeys: TStringList;
rtl: TRegTypeLib;
i: integer;
begin
Assert (reg <> nil);
lstSubKeys := TStringList.Create;
try
with regdo
begin
if not (OpenKey ('TypeLib/' + sLibId + '/' + sLibVersion, FALSE)) then
Exit;
sLibDescription := ReadString ('');
{ load subkeys and parse out for numeric with a win32 subkey }
GetKeyNames (lstSubKeys);
CloseKey;
for i := 0 to lstSubKeys.Count - 1do
begin
sSubkey := lstSubkeys ;
if (sSubKey = '') then
Continue;
if not (sSubkey [1] in ['0'..'9']) then
Continue;
{ win32 }
if not (OpenKey ('TypeLib/' + sLibId + '/' + sLibVersion + '/' + sSubKey + '/win32', FALSE)) then
Continue;
sLibFile := ReadString ('');
CloseKey;
//if not (FileExists (sLibFile)) then
Continue;
{ add item }
rtl := TRegTypeLib.Create;
rtl.Filename := sLibFile;
rtl.Description := Format ('%s (version %s)', [sLibDescription, sLibVersion]);
FItems.Add (rtl);
Break;
end;
{ for }
end;
{ with }
finally
lstSubKeys.Free;
end;
{ finally }
end;