Title: Is DCOM active and retrieve the version
Question: Detecting if DCOM is installed
Answer:
uses Registry, SysUtils;
function GetDCOMVersion: String;
resourcestring
cKey = 'CLSID\{bdc67890-4fc0-11d0-a805-00aa006d2ea4}\InstalledVersion';
var
aReg : TRegistry;
sVer : String;
begin
aReg := TRegistry.Create;
try
with aReg do begin
RootKey := HKEY_CLASSES_ROOT;
LazyWrite := False;
OpenKey(cKey, False);
sVer := ReadString('');
CloseKey;
end;
Result := sVer;
finally
aReg.Free;
end;
end;
function IsDCOMActive: Boolean;
resourcestring
cKey = 'SOFTWARE\Microsoft\OLE';
var
aReg : TRegistry;
sValue : String;
begin
aReg := TRegistry.Create;
try
with aReg do begin
RootKey := HKEY_LOCAL_MACHINE;
LazyWrite := False;
OpenKey(cKey, False);
sValue := ReadString('EnableDCOM');
if sValue = 'Y'
then Result := True
else Result := False;
CloseKey;
end;
finally
aReg.Free;
end;
end;