I have an application which depends of the MSXML6, in most of the machines when the application is deployed this package is already installed, but in a few cases the MSXML6 is not installed, The question is how I can check if the MSXML 6 is already installed?
Asked
Active
Viewed 2,808 times
6
-
2I believe the most reliable way is to simply *try* to create the ole object. – kobik Mar 23 '12 at 22:00
1 Answers
8
you can check if the CLSID exist in the registry using the CLSIDFromProgID function, for MSXML the CLSID is Msxml2.DOMDocument.6.0
Check this sample app
uses
ActiveX,
SysUtils;
{
Msxml2.DOMDocument.2.6
Msxml2.DOMDocument.3.0
Msxml2.DOMDocument.4.0
Msxml2.DOMDocument.5.0
Msxml2.DOMDocument.6.0
}
var
clsid: TCLSID;
begin
try
if Succeeded(CLSIDFromProgID('Msxml2.DOMDocument.6.0', clsid)) then
Writeln('MSXML 6.0 Installed')
else
Writeln('MSXML 6.0 Not Installed');
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Readln;
end.

RRUZ
- 134,889
- 20
- 356
- 483
-
2That will only tell you if the CLSID exists in the Registry, not whether MSXML itself is actually functioning correctly. To do that, you have to instantiate it via `CoCreateInstance()`. – Remy Lebeau Mar 23 '12 at 22:24
-
1@RemyLebeau, Indeed the OP can add the a call to the `CoCreateInstance` function too. – RRUZ Mar 24 '12 at 00:37