PDA

View Full Version : Detect QuickTime


Adam
04-02-2008, 11:44 AM
This will not cover how to run the QuickTime installer because I could see people wanting to run this at different point during the install.

Here is a function that will detect the version of QuickTime. Place this in the Global Functions section of the software:


function ir_GetQuicktimeVersion()
local bOK = true;

--We're checking for Quicktime at this point . . .
bOK = Registry.DoesKeyExist(HKEY_CLASSES_ROOT,"CLSID\\{02BF25D5-8C17-4B23-BC80-D3488ABDDC6B}\\InprocServer32");

if (bOK) then
strFileName = Registry.GetValue(HKEY_CLASSES_ROOT,"CLSID\\{02BF25D5-8C17-4B23-BC80-D3488ABDDC6B}\\InprocServer32","NoName",true);
if (Application.GetLastError() ~= 0) then
bOK = false;
end
end


--If a version was found, we now get the version information
if (bOK) then
verInfo = File.GetVersionInfo(strFileName);
if(Application.GetLastError() ~= 0)then
strVersion = "0.0.0.0";
else
-- OK, we have the file version
strVersion = verInfo.FileVersion;
end
end

--If there was no version found, bOK = false, and verison is set to "0.0.0.0"
if (bOK ~= true) then
strVersion = "0.0.0.0";
end

return strVersion;
end


Now to actually use this code you will have to call the function. In most cases you will want to do a version comparison on this. Here is some code to get you started:


strQTver = ir_GetQuicktimeVersion();
strTargetver = 5.0.0.0
if String.CompareFileVersions(strQTver,strTargetver) == -1 then
-- The installed version is less than 5.0.0.0
-- Here is where you would run the installer for QT.
end