Calling the Javascript functions inside C# for a 64 bit project -
i trying call javascript function "eval" inside c# code (to utilise string operators parser). used following code: https://stackoverflow.com/a/12431435/712700
it crashes though following message--- :
exception details: system.runtime.interopservices.comexception: retrieving com class factory component clsid {0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc} failed due following error: 80040154 class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)).
i believe problem because project/machine 64 bit. not want change project 32 bit, there clsid can use make work 64 bit? or there approach utilise "eval" function javascript within c# code?
you referring following code
type scripttype = type.gettypefromclsid(guid.parse("0e59f1d5-1fbe-11d0-8ff2-00a0d10038bc")); dynamic obj = activator.createinstance(scripttype, false); obj.language = "javascript"; var res = obj.eval("a=3; 2*a+32-math.sin(6)");
the above clsid scriptcontrol
- adding scriptcontrol - language parameter
- using scriptcontrol methods - eval method
from 2 above links see vb6 related , if want use code above mentioned in question need msscript.ocx. please check if have file. may have register correctly using regsvr32
i using 64-bit machine , see file in following folder c:\windows\syswow64
Comments
Post a Comment