JavaScript 能嵌入到 C++ 中作为脚本语言使用吗
1个回答
展开全部
c++ builder 调用javascript脚本问题
js.txt内容:
JScript code
function callSubmit(){
;
}
执行到vScript.OleFunction("callSubmit");就提示未知名称错误了.
C/C++ code
TStringList *ss=new TStringList;
ss->LoadFromFile("js.txt");
WideString js=ss->Text;
delete ss;
Variant vScript;
ShowMessage("1");
vScript=CreateOleObject("MSScriptControl.ScriptControl.1");
ShowMessage("2");
vScript.OlePropertySet("Language", "JavaScript");
ShowMessage("3");
vScript.OleFunction("AddCode",js);
ShowMessage("4");
vScript.OleFunction("callSubmit");
ShowMessage("5");
js.txt内容:
JScript code
function callSubmit(){
;
}
执行到vScript.OleFunction("callSubmit");就提示未知名称错误了.
C/C++ code
TStringList *ss=new TStringList;
ss->LoadFromFile("js.txt");
WideString js=ss->Text;
delete ss;
Variant vScript;
ShowMessage("1");
vScript=CreateOleObject("MSScriptControl.ScriptControl.1");
ShowMessage("2");
vScript.OlePropertySet("Language", "JavaScript");
ShowMessage("3");
vScript.OleFunction("AddCode",js);
ShowMessage("4");
vScript.OleFunction("callSubmit");
ShowMessage("5");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询