I have a code in VB to find the version of a COM dll that i have installed. the relevant code is:
Const HKEY_LOCAL_MACHINE = &H80000002
---------
---------
Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Classes\Wow6432Node\CLSID\{394B1F33-115C-33E5-A008-36E32C5340D9}\InprocServer32"
strValueName = "CodeBase"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
---------
---------
strKeyPath = "SOFTWARE\Classes\Wow6432Node\CLSID\{394B1F33-115C-33E5-A008-36E32C5340D9}\Version"
strValueName = "DLLVersion"
objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,sValue
Wscript.Echo sValue
---------
When i run the code is get the error: Directory\file.vbs(37,1) Microsoft VBScript runtime error: Type mismatch
The 37th line the last one in the code above:
Wscript.Echo sValue
The first GetStringValue is working fine( where i have used InProcServer32) Searched a lot but do not know how to resolve this.
Also i tried using different names strValueName. i tried "CodeBase". i also tried using an empty string to get the default value.
I also tried to get the value of the function in a variable as follows:
set vers=objRegistry.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,sValue
vres gets the value of only the main revision in the version. for example if version is 2.4.7.0 then vers has value 2