Borland news:
Nick Hodges - TeamB
function ClassIsRegistered(const clsid: TCLSID): Boolean;
var
OleStr: POleStr;
Reg: TRegInifile;
Key, Filename: String;
begin
run
Result := ProgIDFromCLSID(clsid, OleStr) = S_OK;
if not Result then Exit; /
Key := Format('\SOFTWARE\Classes\CLSID\%s', [GUIDToString(clsid)]);
Reg := TRegInifile.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
Result := Reg.OpenKeyReadOnly(Key);
if not Result then Exit;
FileName := Reg.ReadString('InProcServer32', '', EmptyStr);
if (Filename = EmptyStr) then
begin
FileName := Reg.ReadString('InProcServer', '', EmptyStr);
end;
Result := Filename <> EmptyStr;
if not Result then Exit;
Result := FileExists(Filename);
finally
Reg.Free;
end;
end;
function IsClassRegistered(GUID: TGUID): Boolean;
var
ClassID: String;
begin
with TRegistry.Create do
try
ClassID := GUIDToString(GUID);
RootKey := HKEY_CLASSES_ROOT;
Result := OpenKey('\CLSID\' + ClassID, False);
finally
Free;
end;
end;
function CheckCOMInstalled(const Name : string): Boolean; overload;
begin
try
Result := CreateOleObject(Name) <> nil;
except
Result := False;
end;
end;
function CheckCOMInstalled(const CLSID : TGUID): Boolean; overload;
begin
try
Result := CreateComObject(CLSID) <> nil;
except
Result := False;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
const
GID : TGUID='{D27CDB6E-AE6D-11cf-96B8-444553540000}';
begin
if CheckCOMInstalled(GID) then
Caption := 'OK'
else
Caption := 'Not';
end;